“Composer”的版本间的差异
跳到导航
跳到搜索
(创建页面,内容为“ =see also= [https://www.runoob.com/w3cnote/composer-install-and-usage.html Composer 安装与使用] [https://developer.aliyun.com/composer 阿里云 Composer…”) |
|||
(未显示同一用户的9个中间版本) | |||
第1行: | 第1行: | ||
+ | =Composer2修改源= | ||
+ | <pre> | ||
+ | wget https://getcomposer.org/download/latest-2.2.x/composer.phar | ||
+ | sudo mv composer.phar /usr/sbin/composer | ||
+ | 放到 /usr/sbin 再给 777吧 测试的 | ||
+ | |||
+ | a). 配置只在当前项目生效 | ||
+ | |||
+ | composer config repo.packagist composer https://mirrors.aliyun.com/composer/ | ||
+ | |||
+ | # 取消当前项目配置 | ||
+ | composer config --unset repos.packagist | ||
+ | |||
+ | b). 配置全局生效 | ||
+ | |||
+ | composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ | ||
+ | |||
+ | # 取消全局配置 | ||
+ | composer config -g --unset repos.packagist | ||
+ | |||
+ | |||
+ | |||
+ | /usr/sbin/composer.phar config repo.packagist composer https://mirrors.aliyun.com/composer/ | ||
+ | /opt/remi/php73/root/bin/php /usr/sbin/composer.phar update | ||
+ | </pre> | ||
+ | |||
+ | =Composer修改源= | ||
+ | composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer | ||
+ | |||
+ | [https://learnku.com/articles/15977/composer-accelerate-and-modify-mirror-source-in-china Composer 国内加速,修改镜像源 ] | ||
+ | |||
+ | [https://blog.csdn.net/qq_45163122/article/details/107141435 Composer切换国内源] | ||
+ | |||
+ | =laravel composer= | ||
+ | <pre> | ||
+ | ** php composer ins | ||
+ | composer install | ||
+ | php artisan migrate | ||
+ | php artisan db:seed | ||
+ | php artisan storage:link | ||
+ | |||
+ | mkdir bootstrap/cache | ||
+ | mkdir storage/framework | ||
+ | mkdir storage/framework/cache | ||
+ | mkdir storage/framework/views | ||
+ | mkdir storage/framework/sessions | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == composer install和composer update的区别== | ||
+ | |||
+ | 这样的结果可能是包太新哦 | ||
+ | 当你执行composer update的时候,composer会去读取composer.json中指定的依赖,去分析他们,并且去拉取符合条件最新版本的依赖。然后他会把所拉取到的依赖放入vendor目录下,并且把所有拉取的依赖的精确版本号写入composer.lock文件中。 | ||
+ | |||
+ | |||
+ | composer.json 是放在 git ? | ||
+ | composer install所执行的事情非常类似,只在第一步的时候有差别。当你本地如果已经存在一份composer.lock时,它将会去读取你的composer.lock而非composer.json,并且以此为标准去下载依赖。当你本地没有composer.lock的时候,它所做的事情和composer update其实并没有区别。 | ||
+ | |||
+ | 这意味着,只要你本地有一份composer.lock,你就可以保证无论过去了多久,你都能拉到相同的依赖。而如果你把它纳入你的项目的版本控制中,那么你就可以确保你项目中的每一个人、每一台电脑,不管什么系统,都能拉取到一模一样的依赖,以减少潜在的依赖对部署的影响。当然,请记得,你应该使用的命令是composer install。 | ||
+ | |||
+ | composer update will update your depencencies as they are specified in composer.json | ||
=see also= | =see also= | ||
第6行: | 第67行: | ||
[https://developer.aliyun.com/composer 阿里云 Composer 全量镜像] | [https://developer.aliyun.com/composer 阿里云 Composer 全量镜像] | ||
+ | |||
+ | [https://www.jianshu.com/p/2d260e2c5eae composer install和composer update的区别] | ||
+ | |||
+ | [https://stackoverflow.com/questions/33052195/what-are-the-differences-between-composer-update-and-composer-install What are the differences between composer update and composer install] | ||
+ | |||
+ | [[category:php]] |
2023年9月22日 (五) 08:32的最新版本
目录
Composer2修改源
wget https://getcomposer.org/download/latest-2.2.x/composer.phar sudo mv composer.phar /usr/sbin/composer 放到 /usr/sbin 再给 777吧 测试的 a). 配置只在当前项目生效 composer config repo.packagist composer https://mirrors.aliyun.com/composer/ # 取消当前项目配置 composer config --unset repos.packagist b). 配置全局生效 composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ # 取消全局配置 composer config -g --unset repos.packagist /usr/sbin/composer.phar config repo.packagist composer https://mirrors.aliyun.com/composer/ /opt/remi/php73/root/bin/php /usr/sbin/composer.phar update
Composer修改源
composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer
laravel composer
** php composer ins composer install php artisan migrate php artisan db:seed php artisan storage:link mkdir bootstrap/cache mkdir storage/framework mkdir storage/framework/cache mkdir storage/framework/views mkdir storage/framework/sessions
composer install和composer update的区别
这样的结果可能是包太新哦 当你执行composer update的时候,composer会去读取composer.json中指定的依赖,去分析他们,并且去拉取符合条件最新版本的依赖。然后他会把所拉取到的依赖放入vendor目录下,并且把所有拉取的依赖的精确版本号写入composer.lock文件中。
composer.json 是放在 git ?
composer install所执行的事情非常类似,只在第一步的时候有差别。当你本地如果已经存在一份composer.lock时,它将会去读取你的composer.lock而非composer.json,并且以此为标准去下载依赖。当你本地没有composer.lock的时候,它所做的事情和composer update其实并没有区别。
这意味着,只要你本地有一份composer.lock,你就可以保证无论过去了多久,你都能拉到相同的依赖。而如果你把它纳入你的项目的版本控制中,那么你就可以确保你项目中的每一个人、每一台电脑,不管什么系统,都能拉取到一模一样的依赖,以减少潜在的依赖对部署的影响。当然,请记得,你应该使用的命令是composer install。
composer update will update your depencencies as they are specified in composer.json
see also
composer install和composer update的区别
What are the differences between composer update and composer install