This is an example plugin for the Craft CMS Beta, inspired by the documentation. It is well documented, and designed to get you up and running quickly, by giving you a working example to start developing from.
The plugin adds an
ingredients table to the database, with custom control panel pages
to add new ingredients. It also adds an Ingredients fieldtype, which can be added to your
sections or pages.
Obviously there are many things in this plugin which could be done differently for a plugin this simple. However, we prefer to do things the most complete way possible, to give you a non-trivial working example.
craft/plugins/cocktailrecipes/on your server.
Cocktail Recipes provides examples of the following Craft components:
Craft provides many extension points, and more examples will be added in future (pull requests accepted).
In addition, a PHPUnit test suite is provided to ensure all components are behaving correctly. To run the tests, run the following commands:
cd plugins/cocktailrecipes composer update --dev vendor/bin/phpunit
All code follows the standard PHP PSR-2 coding style guide. This is being adopted by a large number of PHP frameworks, to ensure consistency in the PHP community. The coding style can easily be verified/fixed by running php-cs-fixer.
This work is licenced under the MIT license.