In a project, I have installed one composer in this independent subdirectory, and I have a main composer in the main directory.
Now, I have set up the classmap of subdirectory composer in the main composer, which works. The subdirectory composer.json and other relevant composer files are not required anymore.
I'd like to correctly remove/uninstall only the subdirectory composer, maybe similar to this post.
which composer in both directories returns:
/usr/local/bin/composer
What are the correct commands to remove a subdirectory composer, without accidentally removing the main composer? Or do I just manually do that?
Composer only ever creates/modifies 2 files and the vendor-folder in your project, composer.json and composer.lock from those 2 files it knows which dependencies to install into the vendor folder. Removing them is all you need to do.
You can safely delete the vendor folder and Composer will install the same versions of the dependencies when a composer.lock is present. If there is no composer.lock it works basically like a composer update, meaning it will install the newest versions and create a composer.lock for them.
If you remove all 3 then composer will not recognize what to do and tell you to create composer.json first. This is all you need to remove anything composer-related from a project.
Related
so my friend and i are working on a project and we install laravel/ui package on his device to use Auth:routes, but after i pull from github it says "In order to use the Auth::routes() method, please install the laravel/ui package." even though i also pulled all file that he push and the gitignore file is empty. does this mean i have to install laravel/ui package in my device too? because i dont want to have the client to installed all those again when we finished and send the folder to our client. we used laravel 7.24 btw
You just need to regenerate the classes as :
composer dump-autoload
you should open the terminal on your project root directory and run :
composer install
on your system.because probably the vendor directory(where the packages are located) added to .gitignore
if vendor not added in .gitignore try to run:
composer dump-autoload
I cloned project from https://github.com/victorfleite/blog-php-oop archived .
But how to create vendor folder and install any dependency?
Just use command composer install in command line (from same directory where composer.json is located). If you don't have an installed composer yet, first install it.
https://getcomposer.org/download/
Go to your Project root directory where composer.json is located
with opening a command prompt and using this commands :
make sure Your lock file contain a compatible set of packages with
running composer update command
after that you can make sure all the packages are installed with composer install command
you can find more packages with composer fund command
Go to cmd or terminal
Make sure you are in the right path (project folder directory)
use cd project_name to go inside the folder and cd .. to go back up out of the folder
In the terminal use the command composer install (if you need to install composer itself, see their official website)
Your vendor folder is installed
In the terminal type php artisan migrate and run the project
When there are already some components downloaded in vendor directory .. What is the effect of running install on it and also when running update?
So I had the same question and this is what I found:
composer install
Checks for composer.lock and downloads/installs the dependency versions fixed within the composer.lock file, otherwise it will install the initial composer.json dependencies (essentially calling "composer update") if composer.lock is not located, which creates the composer.lock file. This would be used to initialize composer.lock otherwise only in production to install newly updated dependencies introduced by "composer update", and inserted into composer.lock.
composer update
Installs the newest dependencies specified by composer.json, and updates the composer.lock file. This would be used in dev, and after updating the dependencies the newly updated composer.lock file would be uploaded deployed and "composer install" run.
Old question, but someone will most likely find it useful, I know I would have a couple hours ago.
I work in a team with ~15 developers and we've been asking ourselves: What is the best practise to work with composer?
Our composer.json has ~5 Packages. We use Bamboo as a Continous Integration system and Subversion.
Today, we run composer self-update / composer update and commit the vendor folder into the repository.
It feels kind of wrong to do that. What is the best practise?
You put the requirements (dev and normal) in the composer.json file
You run composer update to update all dependencies
This command creates a composer.lock file, which contains which versions of the dependencies is used.
Commit that file and exclude (ignore) the vendor/ directory
Whenever you want to install the dependencies, you run composer install. This will install all dependencies with the versions stored in the composer.lock file. This means that everyone have the same versions.
Once in a week, someone run composer update to update all dependencies and create a new composer.lock file with the updated versions.
This file gets committed
Everyone runs composer install (once a day or once in 2 days) and gets the new versions installed.
I would like to clone the symfony-standard-edition create project call but with some custom requirements.
So i dont need Swiftmailer or Doctrine ORM but would like to have the PaginatorBundle.
I tried to copy and edit the composer.json from the standard-edition and did a:
composer.phar install
but that did just install the vendor dir and not the rest like app folder, etc.
So how can i run:
composer.phar create-project symfony/framework-standard-edition myproject
with my edited composer.json?
You can just do composer.phar create-project symfony/framework-standard-edition myproject to bootstrap the whole project, then remove the packages you don't need from composer.json and run update to delete them.
Otherwise you can also git clone the symfony/symfony-standard repository on github, and then start from there, running composer install once you tweaked the composer.json file.