PHP Classes

PHP Composer Install Mushroom Hook Manager: Run Composer package post-installation scripts

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2023-09-09 (7 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 22 This week: 22All time: 10,993 This week: 7Up
Version License PHP version Categories
mushroom-hook-manage 1.0MIT/X Consortium ...7Utilities and Tools, PHP 7
Description 

Author

Smoren


Contributor

This package can run Composer package post-installation scripts.

It provides a plugin class that can register hook functions that will be executed after a package is installed or updated with PHP Composer.

Applications that want to customize the actions performed after installing or updating a package with PHP Composer can use the MushroomHooks class to execute custom code to implement those actions.

Picture of Smoren  Freelight
  Performance   Level  
Name: Smoren Freelight <contact>
Classes: 29 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 14x

Details

Mushroom Hook Manager

Composer plugin for running post-install/post-update scripts of your project's dependencies

Using in your package

Possible example:

Create file MushroomHooks.php in the root of you package source directory with such content:

<?php

namespace Your\Package\Namespace;

class MushroomHooks
{
    public static function afterInstall($params)
    {
        // some actions on after install your package...
    }

    public static function afterUpdate($params)
    {
        // some actions on after update your package...
    }
}

Next add this lines to your package's composer.json file:

...
"require": {
    "smoren/mushroom-hook-manager": "1.0.0",
    ...
},
...
"extra": {
    ...
    "mushroom-use-hooks": true,
    "mushroom-hooks": {
        "after-install": [
            "Your\\Package\\Namespace\\MushroomHooks::afterInstall"
        ],
        "after-update": [
            "Your\\Package\\Namespace\\MushroomHooks::afterUpdate"
        ]
    }
}
...

You can also pass some params to package's hooks in your project (as arguments for methods afterInstall and afterUpdate).

Example for your project'scomposer.json file:

...
"extra": {
    ...
    "mushroom-hooks-params": {
        "your-composer/package-name": {
            "after-install": {
                "some-param": 1,
                "another-param": 2
            },
            "after-update": {
                "foo": "bar"
            }
        }
    }
}
...
  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  src  
File Role Description
  Plain text file HookManager.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:22
This week:22
All time:10,993
This week:7Up