GithubHelp home page GithubHelp logo

boryn / composer-include-files Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hopeseekr-contribs/composer-include-files

0.0 0.0 0.0 17 KB

Include files at a higher priority than autoload files.

License: MIT License

PHP 100.00%

composer-include-files's Introduction

Composer - Include Files Plugin

When using the Composer Autoloader if you need project files included prior to files autoloaded by any of your dependencies your out of luck. No longer!

Installation

composer require 0.0.0/composer-include-files

Usage

Just add the files you need included using "include_files" and they will be include prior to any files included by your dependencies.

// composer.json (project)
{
    "extra": {
        "include_files": [
            "/path/to/file/you/want/to/include",
            "/path/to/another/file/you/want/to/include"
        ]
    },
}

Specific Use Case

A good example of where this is required is when overriding helpers provided by Laravel.

In the past simply modifying bootstrap/autoload.php to include helpers was sufficient. However new versions of PHPUnit include the Composer Autoloader prior to executing the PHPUnit bootstrap file. Consequently this method of overriding helpers is no longer viable as it will trigger a fatal error when your bootstrap file is included.

But now we can use Composer - Include Files Plugin to have Composer include the files in the necessary order.

// composer.json (project)
{
    "require": {
        "laravel/framework": "^5.2",
        "funkjedi/composer-include-files": "^1.0",
    },
    "extra": {
        "include_files": [
            "app/helpers.php"
        ]
    },
}

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.