You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.4KB

hace 2 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Composer - Include Files Plugin
  2. 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!
  3. ## Installation
  4. ```bash
  5. composer require funkjedi/composer-include-files
  6. ```
  7. ## Usage
  8. Just add the files you need included using `"include_files"` and they will be include prior to any files included by your dependencies.
  9. ```json
  10. // composer.json (project)
  11. {
  12. "extra": {
  13. "include_files": [
  14. "/path/to/file/you/want/to/include",
  15. "/path/to/another/file/you/want/to/include"
  16. ]
  17. },
  18. }
  19. ```
  20. ## Specific Use Case
  21. A good example of where this is required is when overriding helpers provided by Laravel.
  22. 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.
  23. But now we can use *Composer - Include Files Plugin* to have Composer include the files in the necessary order.
  24. ```json
  25. // composer.json (project)
  26. {
  27. "require": {
  28. "laravel/framework": "^5.2",
  29. "funkjedi/composer-include-files": "^1.0",
  30. },
  31. "extra": {
  32. "include_files": [
  33. "app/helpers.php"
  34. ]
  35. },
  36. }
  37. ```