Composer ignore folders on package require -
i want use package composer require don't want load folders. know should fork package on github , make changes, want update package when need, , copy/pasting folders isn't best option.
so, thinking, possible somehow on forked repository on composer.json
file, tell don't want load eloquent
, console
folders illuminate/database
package?
reference: https://github.com/illuminate/database
first of there no way exclude these folders composer.
and never understand why people still hunting last 2 bytes of disk space. disk space cheap nowadays. , example never go , delete single functions don't use package or you?
in package/framework use, there things don't use never come mind remove them unless i'm nasa guy sending code pluto or something.
my advice: keep these files unless there big need have them removed.
if need remove them write script , run @ post-package-update
event.
here how define script event in composer.json
:
{ "scripts": { "post-update-cmd": "myvendor\\myclass::postupdate", "post-package-install": [ "myvendor\\myclass::postpackageinstall" ], "post-install-cmd": [ "myvendor\\myclass::warmcache", "phpunit -c app/" ], "post-create-project-cmd" : [ "php -r \"copy('config/local-example.php', 'config/local.php');\"" ] } }
and example myvendor\myclass
class:
<?php namespace myvendor; use composer\script\event; use composer\installer\packageevent; class myclass { public static function postupdate(event $event) { $composer = $event->getcomposer(); // stuff } public static function postpackageinstall(packageevent $event) { $installedpackage = $event->getoperation()->getpackage(); // stuff } public static function warmcache(event $event) { // make cache toasty } }
for more on how use scripts see official composer documentation - scripts.
Comments
Post a Comment