1. Go to this page and download the library: Download milpa/plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
milpa / plugin example snippets
use Milpa\Plugin\ContractResolver;
use Milpa\Plugin\DependencyResolver;
use Milpa\Plugin\GitHubDownloader;
use Milpa\Plugin\LockFileManager;
use Milpa\Plugin\PluginManifest;
// 1. Parse a GitHub source string into owner/repo/constraint.
$downloader = new GitHubDownloader();
$downloader->parseSource('acme/mail-plugin:^2.0');
// -> ['owner' => 'acme', 'repo' => 'mail-plugin', 'constraint' => '^2.0']
// 2. Read + validate a milpa.json manifest (fromArray() mirrors fromPath()).
$manifest = PluginManifest::fromArray([
'name' => 'acme/mail-plugin',
'version' => '2.1.0',
'entrypoint' => 'MailPlugin.php',
'namespace' => 'Acme\\MailPlugin',
'contracts' => ['lve($manifest, [
['name' => 'DatabasePlugin', 'provides' => ['database']],
]);
// -> $resolution->resolvable === true, $resolution->conflicts === []
// 5. Record installed state in milpa.lock.
$lock = new LockFileManager(getcwd());
$lock->generate([
['name' => 'acme/mail-plugin', 'version' => '2.1.0', 'source' => 'github:acme/mail-plugin'],
]);
$lock->verify(); // true — the SHA-256 content hash matches
use Milpa\Plugin\Operations\PluginManagementPlugin;
return [
PluginManagementPlugin::class,
// ...
];
use Milpa\Plugin\Contracts\AppRoot;
$container->registerService(AppRoot::class, new AppRoot(__DIR__ . '/..'));
// config/boot.php — the one call, so the store the kernel boots from and the
// store the operations write to cannot end up being two different files.
$container = new DIContainer();
$plugins = ActivePlugins::wire($container,
$manager = new PluginsManager($container, $registry, $config); // implements ActivationSafetyInterface
new PluginOperations($registry, $installer, $declared, $manager);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.