hirokws/prepper

Registorate installing package's service provider and class alias by Composer facility.

Installs: 247

Dependents: 0

Stars: 2

Watchers: 1

Language: PHP

0.2.2 2013-08-30 04:01 UTC

README

Build Status

Auto update app/config/app.php for Laravel packages with Composer facility.

Summary

Add Prepper to require or require-dev section of your root composer.json.

"hirokws/prepper": "dev-master"

Then composer update, Or :

composer require "hirokws/prepper:dev-master"

And to activate Prepper, run shell script :

vendor/bin/prepper-start.sh

Or on window environment :

vendor/bin/prepper-start.bat

( Sorry, not tested in windonws environment... )

How to use?

Not specially must do to work. Just normally install packages by composer.

If provides.json is there in the installing package, automatically update app.php to register service providers and class aliases by using information that defined in the json file.

Also when packages removed by composer, also remove service providers and class aliases registration from app.php.

Install

By using composer, install "hirokws/preppre": "dev-master".

And run vendor/bin/prepper-start.sh(on Linux/Unix) or vendor/bin/prepper-start.bat(on windows).

Or manually add following json into script section of root composer.json.

    "post-package-install": [
        "Prepper\\Prepper::installPackage"
    ],
    "pre-package-uninstall": [
        "Prepper\\Prepper::uninstallPackage"
    ],

Uninstall

Run vendor/bin/prepper-stop.sh or vendor/bin/prepper-stop.bat.

Or remove "post-package-install" and "pre-package-uninstall" definitions from script section of root composer.json.

provides.json

The provides.json file include information to register/un-register service providers and class aliases for app.php.

Definitions are upper compatible with rtablada/package-installer.

For example, to "Juy/profile" package :

{
    "providers": [
        "Juy\\Profiler\\Providers\\ProfilerServiceProvider"
    ],
    "aliases": [
        {
            "alias": "Profiler",
            "facade": "Juy\\Profiler\\Facades\\Profiler"
        }
    ],
    "PostInstallMessage": "Updated app.php config file automatically for juy/profiler.",
    "PostUninstallMessage": "Automatically remove juy/profiler setting from app.php config file."
}

So, definitions :

  • providers : Registering service provider names.
  • alias and facade : Registering class aliases.
  • PreInstallMessage : A message before registration.
  • PostInstallMessage : A message after registration.
  • PreUninstallMessage : A message before un-registration.
  • PostUninstallMessage : A message after un-registration.
locally supported packages

Prepper have some install definition json files locally. So work on following packages out of box.

(ABC ordered)

Notes

Rrepper modify app/config/app.php file only, don't touch other app.php files.

If the last item of 'providers' / 'aliases' arrays in app.php file never ending with a comma, anything will be added. So keeping the last (all) item must be ending with a comma.

This is forever beta. Because I think Taylor is working out for simuler registration functionlay for Laravel 4.1. So this package will be short time live.

In honesty, this kind of function became fully usefuly when all Laravel package have install information. To be it, must be offically supported.