php - How to include Composer dependencies in a Git repo -
when creating sites using framework silverstripe want use helper modules gridfieldextensions , lumberjack.
i therefore use composer require
add dependencies.
however when follow regular development work flow , use git add -a
add module repo rather code being added repo reference it.
this causes problems when try clone site elsewhere (using jenkins or developer). git clone
or git pull
leaves empty directory.
i solve deleting .git
dir of module , adding files.
is there better way this? using git submodule
option?
somewhere found .gitignore file ignores , have tell include custom modules project. it's like:
# ignore everything... /* # ...but !/.htaccess !/.gitignore !/composer.json !/composer.lock !/capfile !/gemfile !/favicon.ico !/touch-icon-* !/mysite !/some-module #...other modules # theme stuff !/themes/ **/.sass-cache **/node_modules !**/node_modules/_manifest_exclude #no assets in general, /assets/.htaccess !/assets /assets/* !assets/.htaccess
as finbowa said need composer.json , composer.lock file in project , running
composer install
on machine it'll install packages in versions saved in composer.lock file on machine
composer install --no-dev
will install "normal" requirements, no dev-requirements phpunit or other stuff need developing or testing not live
composer install --no-dev -o
will optimize (-o) auto loader, it'll bit faster.
composer update
will update packages, might have funny side effects , break site. use , test afterwards.
composer update silverstripe/framework
will update package , finally
composer update silverstripe/*
will update packages vendor silverstripe (e.g. framework , cms package)
see also:
Comments
Post a Comment