GithubHelp home page GithubHelp logo

composer-constants's Introduction

Composer Constants

This Composer plugin defines constants within the generated autoload.php for the Composer autoloader factory class name, the composer.json file, the base directory, the bin directory, and the vendor directory.

If you need more runtime introspection in your Composer project, see joshdifabio/composed.

Installation

composer require bangpound/composer-constants

Configuration

Set composer-constant-prefix if you want to override the default prefix COMPOSER_.

{
    "extra": {
        "composer-constant-prefix": "SPECIAL_COMPOSER_"
    }
}

Usage

When Composer dumps the autoloader, this plugin will prepend new constants for each of the values above.

Example vendor/autoload.php:

<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

if (!defined('COMPOSER_AUTOLOAD_CLASS')) {
    define('COMPOSER_AUTOLOAD_CLASS', 'ComposerAutoloaderInit283c0e3e301a833e1abc76806341c497');
}

if (!defined('COMPOSER_BASE_DIR')) {
    define('COMPOSER_BASE_DIR', '/srv/project');
}

if (!defined('COMPOSER_BIN_DIR')) {
    define('COMPOSER_BIN_DIR', '/srv/project/bin');
}

if (!defined('COMPOSER_FILE')) {
    define('COMPOSER_FILE', '/srv/project/composer.json');
}

if (!defined('COMPOSER_VENDOR_DIR')) {
    define('COMPOSER_VENDOR_DIR', '/srv/project/vendor');
}

return ComposerAutoloaderInit283c0e3e301a833e1abc76806341c497::getLoader();

If you want to use the Composer autoloader in your Symfony Dependency Injection Container, set up the service this way:

services:
    class_loader:
        class: Composer\Autoload\Classloader
        factory: [ '@=constant("COMPOSER_AUTOLOAD_CLASS")', getLoader ]

composer-constants's People

Contributors

bangpound avatar

Stargazers

Anderson Grüdtner Martins avatar Yann B. avatar Cees-Jan Kiewiet 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.