Skip to content

Commit

Permalink
added jigsaw integration
Browse files Browse the repository at this point in the history
  • Loading branch information
reed-jones committed Feb 9, 2020
1 parent 09eede5 commit 10a9414
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 247 deletions.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Neocities PHP Client Library
Neocities-php is a PHP wrapper of the [Neocities.org](https://neocities.org/) API.
Neocities-php is a PHP wrapper of the [Neocities.org](https://neocities.org/) API. Now with [Jigsaw](https://jigsaw.tighten.co/) integration

## Installation
```sh
Expand Down Expand Up @@ -77,3 +77,40 @@ $result = $neocities->key();

var_dump($result);
```

## Jigsaw Integration

Neocities-PHP can be integrated with [Tighten's Jigsaw](https://jigsaw.tighten.co/). After installing this packing into your jigsaw project, Register the plugin in `bootstrap.php`
```php
// bootstrap.php
Jigsaw::mixin(new \ReedJones\Neocities\NeocitiesDeployment($container));
```

With this in place, all that is left to do is add your neocities api key your your .env file (if id doesn't exist, create it)
```sh
# .env
NEO_CITIES_API_KEY="YOUR_API_KEY_HERE"
```

Now to build & deploy from the command line, run the new `jigsaw deploy` command which accepts the same parameters as the `build` command.
```sh
# Build & deploy your 'local' build
./vendor/bin/jigsaw deploy
```
```sh
# Build & deploy your 'production' build
./vendor/bin/jigsaw deploy production
```

### Jigsaw Programmatic Usage

After following the above instructions for setting up a neocities deployment with jigsaw, a `deployToNeocities` method is available for programmatic use from bootstrap.php (or elsewhere). An Example:
```php
// Programmatic API Usage
$events->afterBuild(function (Jigsaw $jigsaw) {
if ($jigsaw->getEnvironment() === 'production') {
// Automatic deployment after all production builds
$jigsaw->deployToNeocities();
}
});
```
Loading

0 comments on commit 10a9414

Please sign in to comment.