Giter Site home page Giter Site logo

weierophinney / zf-composer-autoloading Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zfcampus/zf-composer-autoloading

1.0 3.0 0.0 68 KB

Create Composer autoloading rules for your Zend Framework modules

License: BSD 3-Clause "New" or "Revised" License

PHP 100.00%

zf-composer-autoloading's Introduction

zf-composer-autoloading

Build Status Coverage Status

Introduction

The zf-composer-autoloading package provides a single vendor binary, zf-composer-autoloading, which provides following commands:

  • enable - add the named module to the project autoloading rules defined in composer.json, and
  • disable - remove autoloading rules for the module from composer.json

Both commands also dump the autoloading rules on completion.

Upgrading

If you were using the v1 series of this component, the script previously exposed was autoload-module-via-composer. That script is now renamed to zf-composer-autoloading.

Installation

Run the following composer command:

$ composer require --dev "zfcampus/zf-composer-autoloading"

Note the --dev flag; this tool is intended for use in development only.

Usage

$ ./vendor/bin/zf-composer-autoloading \
> enable|disable \
> [help|--help|-h] \
> [--composer|-c <composer path>] \
> [--type|-t <psr0|psr4>] \
> [--modules-path|-p <path>] \
> modulename

Commands

  • enable - enables composer-based autoloading for the module.
  • disable - disables composer-based autoloading for the module.

Arguments

  • help, --help, and -h each display the script's help message.
  • --composer and -c each allow you to specify the path to the Composer binary, if it is not in your $PATH.
  • --type and -t allow you to specify the autoloading type, which should be one of psr-0 or psr-4; if not provided, the script will attempt to auto-determine the value based on the directory structure of the module.
  • --modules-path and -p allow you to specify the path to the modules directory; default to module.
  • modulename is the name of the module for which to setup Composer-based autoloading.

Notes

  • Modules are assumed to have a src/ directory. If they do not, the autoloading generated will be incorrect.
  • If unable to determine the autoloading type, PSR-0 will be assumed.
  • On enabling autoloading, if the Module class file for the module is in the module root, it will be moved to the module's src/ directory (zend-mvc applications only).

Examples

  1. Autodetect a module's autoloading type, and generate a Composer autoloading entry for "Status" module.

    $ ./vendor/bin/zf-composer-autoloading enable Status
  2. Autodetect a module's autoloading type, and remove a Composer autoloading entry for "Status" module.

    $ ./vendor/bin/zf-composer-autoloading disable Status
  3. Specify PSR-0 for the module type, and generate a Composer autoloading entry for "Status" module.

    $ ./vendor/bin/zf-composer-autoloading enable --type psr0 Status
  4. Specify PSR-4 for the module type, and generate a Composer autoloading entry for "Status" module.

    $ ./vendor/bin/zf-composer-autoloading enable --type psr4 Status
  5. Specify the path to the composer binary when generating autoloading entry for "Status" module:

    $ ./vendor/bin/zf-composer-autoloading enable -c composer.phar Status
  6. Specify the path to modules directory, and generate a Composer autoloading entry for "Status" module.

    $ ./vendor/bin/zf-composer-autoloading enable -p src Status

zf-composer-autoloading's People

Contributors

michalbundyra avatar weierophinney avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.