Open shiftsave opened 9 years ago
@shiftsave Sure!
To install you’ll need to use Composer. It is a command line tool for installing PHP dependencies. Installation of Composer for Mac, Linux, and Windows can be found in their docs. (I recommend installing it globally so it can be used simply as composer
.)
Once Composer is installed you’ll need to create a JSON file in the root of your project called composer.json. The contents should be similar to the following (but may have other stuff if you’re already using Composer for your project):
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/matthewspencer/kirby-twig-plugin"
}
],
"require": {
"matthewspencer/kirby-twig-plugin": "2.0.5",
"composer/installers": "~1.0"
},
"extra": {
"installer-paths": {
"site/plugins/{$name}/": ["type:kirby-plugin"]
}
}
}
Note: You may need to be update the installer-paths
for your project, which sets the relative path to the Kirby plugins directory.
Then run composer install
in the directory that has the composer.json file. (You may need to run it as php composer.phar install
depending on how it was installed on your system.)
Then you’ll need to tell Kirby some paths in the main config.php file:
kirby()->roots->vendor = dirname( kirby()->roots()->site() ) . '/vendor';
kirby()->roots->twig = kirby()->roots()->site() . '/twig';
c::set( 'twig.file.extension', 'twig' );
These are set so the plugin can instantiate Twig.
Now it should be installed. From here, follow the usage from the README.
Any chance you could explain in a little more detail how to installing this on Kirby. I couldn't quite follow the instructions. :\
Thanks! I