mahdyaslami / simple-pluginable
Functions that make simple pluginable.
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/mahdyaslami/simple-pluginable
Requires
- symfony/filesystem: ^5.1
README
This package allows other packages to make these changes at minimal cost if they need to change the structure of the project folder.
Installation
- Add following script to your project
composer.jsonfile.
{
...
"scripts": {
"post-autoload-dump": "Simplex\\Plugins\\Composer::postAutoloadDump"
}
}
This script will run after dump autoload command and start process of changing workspaces.
- Install
simple-pluginablepackage.
composer require simple-pluginable
Process
Pluginable runs after the dumpautoload command and checks all packages and executes the installer.php file if it exists.
Installer(installer.php) of packages will update project workspace.
Pluginable prevents a plugins from being installed twice and after installing all the plugins, they save them in the plugins.json file in the project root directory.
How create a plugin?
It's simple. you need to only create your package and we prepare some options that helps you to install your workspace.
Installer
Create install.php file on root of your package (don't use it on composer.json->autoload). and finally write your installation script.
You can use Simplex\Plugins\Installer::basePath for knowing where is workspace.
If you just want to copy some file you can create a folder with workspace name and put your structure there. and finally add following code on your installer:
<?php
$override = true;