I had an old Yii2 project that was built 2+ years ago on version 2.0.12, then left idle since around this time. Today I wanted to re-awaken this project and update it to the latest version
of Yii2 and all dependencies.
Reading the Upgrade notes here I saw that the following command will get me to the latest stable version:
composer require "yiisoft/yii2:~2.0.38" --update-with-dependencies
After this command succeeded I confirmed by running ./yii command in the project root that I am now on 2.0.38, however there are a few things missing. The main README.md remains the same as in version 2.0.12 and there are some files present in a clean build of 2.0.38 that remain missing from the root, e.g. Vagrantfile and docker-compose.yml.
Is there an undocumented step I am missing here to do this cleanly? Surely it's not down to manual intervention to go find/add these missing elements to fully upgrade?
Related
I have tried to install composer according to the three methods provided by composer's official website. There is no problem in executing composer - V under PHP installation directory. However, if you execute composer - V in any directory in any way, the following error will be reported repeatedly:
This is the error output from the implementation of composer - V and the PHP version number
I don't know if the latest version of composer is not uninstalled and there are residual error. This question has made my head swell. Which international friend can take a look at it!
The problem has been solved. I used the software installation method from the official Composer website. When setting the environment variables, I put the composer path first, and then I can use composer in any directory, although I don't know what happened in the end. This is a screenshot of the environment variables configured in my Windows 10.
I'm working on a project based on PHP7 and Laravel. Unfortunately, there was a problem with dependencies and package versions.
I guessed that the previous developer working on the project started updating packages by calling
composer update
on his local dev environment.
Therefore, a new composer.lock file has been generated and everything has been pushed to the production server - however, the composer update command has not been called on the production...
There is a problem with the incompatibility of the PHP version and other errors in dependencies.
This is a very large project and I wouldn't like to migrate now to higher versions on the production server.
I am currently preparing a development environment and I care about maintaining the maximum compatibility of all package versions with what is on production.
By calling:
composer install
on local environment, I'm receiving a series of errors related to the incompatibility of the package versions.
Is there any way to regenerate / restore composer.json and composer.lock based on what is currently installed on the production server? Unfortunately, at this moment composer.lock on production doesn't completely reflect the current state of actually installed versions.
What is a safe and good way to recreate locally a cloned project from a repository on a production server - and maintain full compatibility of all package versions, the correct form of composer.json and composer.lock?
Thanks in advance for your help!
To run composer update and composer install
You can run with this code
composer install --ignore-platform-reqs
Or for update
composer update --ignore-platform-reqs
I found https://www.wuhaiqiao.com/2020/11/24/329.html
No, there is no way to recreate composer.json file based on what is already installed in /vendor. You can look for /vendor/composer/installed.json file as a reference for installed versions of all packages.
What you need to do in this case is:
Make sure your local environment is exactly the same as your production one. You can fake it if needed in your composer.json too by using platform configuration.
Your composer.lock file is of no use. Get /vendor/composer/installed.json file from your production. Delete your /vendor folder.
Run composer install. Write down all packages that have issues and check provided solutions by Composer.
Start downgrading the versions in your composer.json for packages that have issues based to the solutions provided by Composer. Be sure to look into those packages yourself - developers aren't always very strict with the way they maintain dependencies and versioning of their packages. You can always just take package version from production's /vendor/composer/installed.json and place that specific version in your composer.json.
Repeat steps 3-4 until you can finally generate new composer.lock file. Make sure your composer.json and composer.lock files are tracked by your VCS and fixate the changes.
I need to install CakePHP 3 in an old-fashioned upload-unzip-run way.
The archive I've downloaded from cakephp/cakephp/tags does not contain the default folders like webroot, Model etc., which means it's not complete.
The official documentation does not cover this. Here's a relevant Github issue I found, but the person ends up still using Composer.
There's also cakephp/app and it seems to include those missing files, but it's not mentioned in cakephp/cakephp's composer.json, and even if I download it I've no idea how to merge the packages.
Packaged app (cakephp/app) releases that include all dependencies (framework (cakephp/cakephp), standard CakePHP plugins (cakephp/debugkit, cakephp/bake, etc), required third party libraries) can be found on GitHub.
https://github.com/cakephp/cakephp/releases
It's the download with the small package symbol, named like cake-3-x-x.zip.
However, it isn't a good idea to ditch the dependency manager, as keeping the code base and the autoloader up to date will be rather tedious, and, no offense, I have my doubts that you'll be able to handle this properly if you don't even know how to stitch the app and cake packages together.
You can install CakePhp 3 without Composer.
You need minimum requirements to install CakePhp 3 and CakePhp 3 boilerplate ( fresh copy of Cakephp 3 ).
You can download CakePhp 3 boilerplate from github.
Requirements
Server
HTTP Server. For example: Apache. Having mod_rewrite is preferred,but by no means required.
PHP 5.4.16 or greater.
mbstring extension
intl extension
Database :
MySQL (5.1.10 or greater)
PostgreSQL
Microsoft SQL Server (2008 or higher)
SQLite 3
All built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.
CakePhp 3 Boilerplate:
Repository Home
https://github.com/cakephp/cakephp/releases
CakePhp 3.1.4
https://github.com/cakephp/cakephp/releases/download/3.1.4/cakephp-3-1-4.zip
CakePhp 3.0.15
https://github.com/cakephp/cakephp/releases/download/3.0.15/cakephp-3-0-15.zip
Download one repository and unzip where you wanted to install it.
You may get one error like ( you may not get error if you are lucky!)
Fatal Error
Cake\Error\FatalErrorException
Error: Class 'Cake\Mailer\Email' not found
File D:\xampp\htdocs\practice\cakephp\cakephp-3-1-4\config\bootstrap.php
Line: 138
Then you have to comment two line in config/bootstrap.php
//Email::configTransport(Configure::consume('EmailTransport'));
//Email::config(Configure::consume('Email'));
And finally you got CakePhp 3 installed.
[I am also new in CakePhp 3.So Please inform me if there are any wrong in my given process.]
Thanks
Use Composer.
Install Composer locally, follow the Cake installation instructions, then upload the created folders to the target webhost.
Easy, For CakePHP 3.x you can just download the release you want from here
https://github.com/cakephp/cakephp/releases (eg. https://github.com/cakephp/cakephp/releases/tag/3.3.16).
For a complete installation select the first download link (.zip)
the other links are just for the src
Just run this command to get a clone of CakePHP 3.10.0
git clone -b 3.x git://github.com/cakephp/cakephp.git
Try simple steps
1. Download XAMPP Server.
2. Install XAMPP server.
3. Go to ..\xampp\php\php.ini and open.
4. Add this line (extension=php_intl.dll) or if exist uncomment.
5. Download Composer setup from https://github.com/composer/windows-setup/releases/
6. Install composer and give php.exe file in path
7. Open cmd and check now php version using command php -v. if its showing php version its means its working.
8. Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
9. Finished folder created in htdocs.
I'd like to know whats the difference when creating new symfony project with new symfony installer that has appeared last time and old-way composer.
I've installed latest version of symfony (2.6.1) with both, and result was different, for example when I install symfony with composer, i get .gitignore file.
When I install with new symfony installer script, gitignore is missing.
Here is amount of catalogs and files in fresh project:
symfony installer: 1498 directories, 7136 files
symfony installer + composer update: 1571 directories, 7749 files
composer create-project: 1615 directories, 7905 files
I suppose I'll stick to old way - composer, since new installer seems to be bugged or at least not complete yet, however I'd like to understand more on this topic, whats the difference, is it safe to use new installer etc?
As Leggendario already explained, the installer downloads the dist files from the website (a .tar.gz or .zip file). This speeds up the installation process quite a bit.
However, when building the dist files, symfony.com uses a custom build script which removes some files and changes some things. On the other hand, composer simply downloads the repository for you.
The main differences:
Composer downloads the latest dependencies (as Leggendario pointed out), while the build script contains the latest files at the moment of building.
Composer uses the dev versions and thus uses git clone to download the packages. The build script uses only stable packages, which will make Composer use the dist version. Some packages remove test and doc files from their dist files.
Composer contains all project related information, like a .gitignore. The build script previously assumed the person installing it didn't have git, so removed this file and other git related files like the .gitkeep files in app/cache and app/logs.
I any case, both the installer and composer always give you a working version of the Symfony Standard Edition.
At last, the build script was changed now the installer became the official way of installing. It'll now contain the git related files. On the other hand, it'll not contain the LICENSE file, UPGRADE-*.md files and README.md file. So in the end, we can say that the one installed by the installer is more usable, as it removes useless files.
Symfony2 Installer will downloaded it from the web site ( in this case: http://symfony.com/download?v=Symfony_Standard_Vendors_2.6.1.zip ).
To see the differences between symfony installer and the classic composer create-project is enough to take a look at both composer.lock: https://www.diffchecker.com/oig86oki
On the left the composer.lock generated after composer create-project, on the right symfony installer. It was obvious to everyone that Symfony2 downloaded from an archive could not have the lastest packages. So, do the update with composer update.
Again, on the left the composer.lock of composer create-project, on the right the new composer.lock after the update: https://www.diffchecker.com/lj5j2eap
As we expected. But in the vendor dir there are not the same number of file. Some folders are not there. Some folders with functional tests are not downloaded with symfony installer. You need to force composer to update all packages, or reinstall them.
Did you update installer as well with :
symfony self-update
or in windows :
php symfony.phar self-update
As stated here ?
That's perhaps one part of the answer.
Among differences, the installer seems to deal better with different symfony versions.
I'm trying to install Laravel 4.1 using the Laravel installer but the docs isn't very descriptive.
Can someone please give a step by step guide on how to do this? I'm completely new to Laravel and PHP frameworks as a whole.
I'm on a Windows 7 machine running WAMP 2.2.
This information/answer isn't quite up to date anymore. The instructions here will install the latest version which is no longer 4.1. For those still wanting to install Laravel 4.1 (despite 4.2+ being out), use the following command.
composer create-project laravel/laravel project_name 4.1
You could replace the 4.1 with 4.0 or 4.2 depending on your situation.
Laravel 4.1 is handy if you aren't in control of your PHP version and you're stuck back on 5.3.7
Laravel 4.2 requires PHP 5.4.
When upgrading a project to a newer version of Laravel, be sure to review the release notes
Installing Laravel means simply downloading Laravel Application bootstrap, which has to be placed in your project directory. That application has a composer.json file, which will, after you run composer install command, download all necessary dependencies (including core framework).
That is one way. Another preferred way is directly through:
composer create-project laravel/laravel project_name
In both cases, you need to have composer installed on your machine. Composer is a modern PHP package manager, which has a ton of benefits (autoloading, custom commands...).
There is really no need for two downvotes, especially when this guy was reading documentation, which he couldn't understand. We were all installing Laravel for the first time.
If you want install laravel via Laravel Installer use this method:
First, open up command line. then enter:
composer global require "laravel/installer=~1.1"
Now go to:
C:\Users\ {User Name} \AppData\Roaming\Composer\vendor
Copy and paste vendor in your destination folder.
Now in your destination folder hold the shift key down and press right click and in opened navigation menu click on "open command window here" then enter command below:
laravel new your_project_destination
Ex:
laravel new laraveltest