These docs are for v0.1.4-alpha. Click to read the latest docs for v1.0.0-dev.

Creating a plugin

A plugin should extend Mascame\Artificer\Plugin\AbstractPlugin

<?php namespace NamespaceHere;

use Mascame\Artificer\Plugin\AbstractPlugin;

class MyPlugin extends AbstractPlugin {

    public $version = '1.0';
    public $name = 'My plugin';
    public $description = 'This is a test plugin';
    public $author = 'Jhon Doe';
    public $thumbnail = ''; // url
  
  	// This is the key you specified on registering and will be automatically filled just after instantiation
  	public $namespace = '';

  	/**
     * Artificer does not know about your constructor so you
     * can inject any dependecy you need
     */
  	public function __construct() {}
  
    /**
     * This will be called if the plugin is installed
     */
    public function boot()
    {
      	// Use the hooks you need or do whatever
    }

    /**
     * This will be called when plugin is installed
     */
    public function install() {
      	// Maybe some table creation
    }

    /**
     * This will be called when plugin is uninstalled
     */
    public function uninstall() {
      	// Maybe some table drop or cleanup
    }
}