Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sourcebroker/deployer-loader
Autoload of root project vendors and recursive load of deployer tasks.
https://github.com/sourcebroker/deployer-loader
deployer deployment loader php sb-dl
Last synced: 3 days ago
JSON representation
Autoload of root project vendors and recursive load of deployer tasks.
- Host: GitHub
- URL: https://github.com/sourcebroker/deployer-loader
- Owner: sourcebroker
- License: mit
- Created: 2017-10-01T11:17:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-28T15:32:55.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T00:09:41.057Z (6 days ago)
- Topics: deployer, deployment, loader, php, sb-dl
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
deployer-loader
===============
|.. image:: http://img.shields.io/packagist/v/sourcebroker/deployer-loader.svg?style=flat
:target: https://packagist.org/packages/sourcebroker/deployer-loader.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat
:target: https://packagist.org/packages/sourcebroker/deployer-loader|
.. contents:: :local:
What does it do?
----------------This package allows to:
1. Register your project vendor classes to be used in deploy.php. Read "Include class loader" for more info why you
should not include your project vendor/autoload.php in deploy.php.
2. Load single task/setting file.
3. Load multiple tasks/settings files from folders.Installation
------------
::composer require sourcebroker/deployer-loader
Usage
-----Include class loader
++++++++++++++++++++If Deployer is used as phar from global install or from local in ``./vendor/bin/dep`` (installed from ``deployer/dist``) then
it is already including his own ``vendor/autoload.php``. If in ``deploy.php`` file we will require ``vendor/autoload.php``
from our project then it's like asking for trouble because we are joining two autoloads with non synchronized dependencies.
The second composer ``vendor/autoload.php`` added by us in ``deploy.php`` has priority because the composer uses the
``prepend`` parameter of ``spl_autoload_register()`` method which adds an autoloader on the beginning of the autoload
queue instead of appending it. So classes from our project will be used before classes from Deployer phar.The solution is to include in ``deploy.php`` the autoload.php from ``sourcebroker/deployer-loader``.
Using ``spl_autoload_register()`` it will register new closure function to find classes and it will register itself without
``prepend`` parameter. So first classes from Deployer phar autoload will be used and if they will not exists
there will be fallback to classes from the main project vendors.How to use it? Just include autoload at the beginning of your ``deploy.php`` (and remove ``vendor/autoload.php`` if you had one)
::
require_once(__DIR__ . '/vendor/sourcebroker/deployer-loader/autoload.php');
After this point in code you can use all vendor classes declared in psr4 of your ``composer.json`` files.
Loading deployer tasks
++++++++++++++++++++++The package sourcebroker/deployer-loader allows you also to include single files or bunch of files from folder
(recursively).- Example for loading single file:
::
new \SourceBroker\DeployerLoader\Load(
[path => 'vendor/sourcebroker/deployer-extended-database/deployer/db/task/db:copy.php'],
[path => 'vendor/sourcebroker/deployer-extended-database/deployer/db/task/db:move.php'],
);- Example for loading all files from folder recursively:
::
new \SourceBroker\DeployerLoader\Load(
[
path => 'vendor/sourcebroker/deployer-extended-database/deployer/db/'
excludePattern => '/move/'
],
[
path => 'vendor/sourcebroker/deployer-extended-media/deployer/media/'
],
);You can use preg_match "excludePattern" to exclude files.
Changelog
---------See https://github.com/sourcebroker/deployer-loader/blob/master/CHANGELOG.rst