PHPackages                             deploy/deploy-revision - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. deploy/deploy-revision

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

deploy/deploy-revision
======================

Deploy new code revision by performing operations from YAML playbooks.

08PHP

Since Feb 11Pushed 9y agoCompare

[ Source](https://github.com/BR0kEN-/deploy-revision)[ Packagist](https://packagist.org/packages/deploy/deploy-revision)[ RSS](/packages/deploy-deploy-revision/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Deploy Revision
===============

[](#deploy-revision)

Create a YAML playbook, define a code revision, specify upgrade path as commands for performing and distribute them between environments.

[![Build Status](https://camo.githubusercontent.com/35facb2e322c58abc2967b7ab65443108e331695ec3fc0247830518402d4ff5f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4252306b454e2d2f6465706c6f792d7265766973696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/BR0kEN-/deploy-revision)[![Code coverage](https://camo.githubusercontent.com/66484df9bf34cd0da8d9da65f93156c3820a601734fb219d3e1f534716dd73f1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f4252306b454e2d2f6465706c6f792d7265766973696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/BR0kEN-/deploy-revision/?branch=master)[![Quality Score](https://camo.githubusercontent.com/95ff1fbccf91a0ee64e0f5998cd1e372750690917ef2ada4ba8d5618c4201328/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4252306b454e2d2f6465706c6f792d7265766973696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/BR0kEN-/deploy-revision)[![Coding standards](https://camo.githubusercontent.com/3ef74fd3852edd57bd231215660c35bff69cb03a3d59a63146a1be65a6d821fc/68747470733a2f2f7374796c6563692e696f2f7265706f732f38313432323436332f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/81422463)[![Total Downloads](https://camo.githubusercontent.com/07c89439b839d415e178672208e90c433b25d23927ad7215092f556a7bfaebc2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465706c6f792f6465706c6f792d7265766973696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deploy/deploy-revision)[![Latest Stable Version](https://camo.githubusercontent.com/be7197a12f368ea6d9245bcb5bc066c48b08911f294b721920ca87e417192e9b/68747470733a2f2f706f7365722e707567782e6f72672f6465706c6f792f6465706c6f792d7265766973696f6e2f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/deploy/deploy-revision)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deploy/deploy-revision)

Installation
------------

[](#installation)

```
composer require deploy/deploy-revision:1.*
```

Usage
-----

[](#usage)

A view of deployment playbook.

```
commands:
  # Commands below will be executed only if environment ID will match.
  lush_website_at:
    140:
      - "drush updb"
  # It's predefined namespace for commands which should be run everywhere.
  global:
    89:
      - "drush cc all"
    121:
      - "drush cc drush"
      - "print bla bla"

# The order of commands for execution will looks like (only in case if current code version is lower than defined):
# - For "lush_website_at" environment:
#   - drush cc all - will be removed because we have "drush updb" (if logic like in "filter()" below will be implemented).
#   - drush cc drush
#   - print bla bla
#   - drush updb
#
# - For "global" environment:
#   - drush cc all
#   - drush cc drush
#   - print bla bla
```

Initialize the library at start.

```
require_once 'vendor/autoload.php';

use DeployRevision\DeployRevision;

$deploy = new DeployRevision();
```

Use own YAML parser (if don't like Symfony).

```
class SpycYaml implements YamlInterface
{
    /**
     * {@inheritdoc}
     */
    public function isAvailable()
    {
        return class_exists('Spyc');
    }

    /**
     * {@inheritdoc}
     */
    public function parse($content)
    {
        return \Spyc::YAMLLoadString($content);
    }

    /**
     * {@inheritdoc}
     */
    public function dump(array $content)
    {
        return \Spyc::YAMLDump($content);
    }
}

$deploy
    ->getContainer()
    ->getDefinition('deploy_revision.yaml')
    ->setClass(SpycYaml::class);
```

Look for `*.yml` playbooks inside a directory and for tasks in particular file.

```
$deployment = $deploy->getWorker();
// Read particular playbook.
$deployment->read('../lush_deploy.yml');
// Read playbooks within directory.
$deployment->read('../lush_deploy');
```

Set an environment ID and/or path to file where revision ID should be stored (or duplicated, from DB for instance).

```
$deployment = $deploy->getWorker('lush_website_at', 'private://revisions/revision');
```

Filter commands. Callback should return the command for deletion.

```
$deployment->filter(function ($command, array $commands, callable $resolver) {
    // Remove "drush cc css-js" since "drush updb" will do the job for it.
    if ('drush cc css-js' === $command && isset($commands['drush updb'])) {
        return $command;
    }

    // Remove all previously added "drush cc all" from the list if "drush updb" exists.
    return $resolver(true, ['drush updb'], ['drush cc all'])
        // Remove newly added "drush cc all" if "drush updb" in the list.
        ?: $resolver(false, ['drush cc all'], ['drush updb']);
});
```

Run deployment.

```
$deployment->deploy(function ($command) {
    $arguments = explode(' ', $command);
    $program = array_shift($arguments);

    switch ($program) {
        case 'drush':
            drush_invoke($program, $arguments);
            break;

        default:
            printf('No handler found for the "%s" command.', $command);
  }
});
```

Save new revision ID.

```
$deployment->commit();
```

Notes
-----

[](#notes)

- All tasks from playbooks must be handled inside of deployment callback. This means that an implementation for recognizing the commands and for executing them should be done. Otherwise you'll not have any effect placing commands inside playbooks.
- Tasks collected in order you running the `->read()` method. If you are reading `test1.yml` and `test2.yml` and both files have the same revision number inside, then commands from first file will be located above ones from second.

    Reading of the directory will be done in alphabetical order. If multiple playbooks have the same revision numbers, then the only way you can affect on ordering - is to set file names in correct order.

Testing
-------

[](#testing)

Run PHPUnit tests locally.

```
./bin/phpunit --coverage-text
```

### Scrutinizer CI

[](#scrutinizer-ci)

Used for generating [tests coverage](.scrutinizer.yml#L4-L10).

### Travis CI

[](#travis-ci)

Used for running tests on [various PHP versions](.travis.yml#L4-L8).

### Style CI

[](#style-ci)

Used for verifying [coding standards](.styleci.yml#L1). Actually **Scrutinizer** doing this as well.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e8b4c73b9ba0729e2c5b690cbdb63bfbe982130513b0c9d64c6c26e1d4d32ff?d=identicon)[BR0kEN-](/maintainers/BR0kEN-)

---

Top Contributors

[![BR0kEN-](https://avatars.githubusercontent.com/u/2760616?v=4)](https://github.com/BR0kEN- "BR0kEN- (23 commits)")

---

Tags

deploydeploymentrevisionssymfony-di-containeryaml

### Embed Badge

![Health badge](/badges/deploy-deploy-revision/health.svg)

```
[![Health](https://phpackages.com/badges/deploy-deploy-revision/health.svg)](https://phpackages.com/packages/deploy-deploy-revision)
```

###  Alternatives

[deployer/deployer

Deployment Tool

11.0k25.4M207](/packages/deployer-deployer)[appwrite/server-ce

End to end backend server for frontend and mobile apps.

55.3k84.2k](/packages/appwrite-server-ce)[pragmarx/health

Laravel Server &amp; App Health Monitor and Notifier

2.0k1.0M2](/packages/pragmarx-health)[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22476.7M6](/packages/felixfbecker-language-server-protocol)[heroku/heroku-buildpack-php

Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP and Apache2/Nginx as on Heroku

8161.3M10](/packages/heroku-heroku-buildpack-php)[tiamo/phpas2

PHPAS2 is a php-based implementation of the EDIINT AS2 standard

4674.7k](/packages/tiamo-phpas2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
