Remove laravel 5 and install laravel 4 - laravel

I was about to install laravel 4 but accidentally installed laravel 5 instead, now I need to remove 5 and install 4, I tried to change in the composer the line that says: require: "laravel/framework": "5.1.", and overwrite it by "laravel/framework": "4.2.", but when I create a new project it still creates it in laravel 5 unless I point to version 4 with the creation command, any help?

Go into your composer.json folder, and edit
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*" << change this to 4.2
"torann/laravel-asana": "0.2.*#dev",
"asana/asana": "^0.1.2"
},
then run composer dump-autoload and then try to run composer update.

when you use the composer command you can specify which version you want to install you can do that like :
composer create-project laravel/laravel=4.2 yourdirectoryname

there... I also faced a similar problem when trying to do my mini project. In order to clear the old Laravel application installed Just delete the laravel. bat as shown in my screenshot. You also need to clear the cache memory
like
php artisan cache:clear
This will get rid of the laravel and your system is ready for a fresh installation.

Related

Laravel 5.5 install not generating .env file

I have installed laravel 5.4 multiple times.
Now I'm trying to install laravel 5.5 using same command And it doesn't work.
composer create-project --prefer-dist laravel/laravel blog dev-develop
It doesn't seem to have any errors on installation, only lot of suggestions.
But no key is generated and no .env file is created.
When I try to make php artisan key:generate
/public_html/blog/.env): failed to open stream: No such file or directory
Got the same problem days a go, the problem was because composer was not updated, solved it updating composer, you can run:
composer self-update
Or you can download the latest version there, then you can create the project again and the .env file will be automatically created.
I have this version
Composer version #package_branch_alias_version# (1.0.0-beta2) 2016-03-27 16:00:34
When I run composer self-update I get
[InvalidArgumentException]
Command "self-update" is not defined.
shell command: cp .env.example .env
If you just want to make current setup work, just try doing the following:
cp .env.example .env
php artisan key:generate
But as suggested by one of the answers here, you should update your composer if you have an old version. To check your installed version, do so with composer -v
This is happening because of your Laravel Installer or Composer version. I have faced the same problem and found following 2 different solutions:
Generally, you can solve with by running composer global update command and then run composer update command from your project directory. This solution basically updates your installer and then your project.
If still, you have this problem, then you need to run composer self-update command first and then run composer update command from your project directory. It will update your composer version and then your project.
Hope this information will help you to fix.

how to make php artisan command available?

I read previous posts here about same problem but they did not solve my problem. I am running wamp latest version on windows 7 and I cloned a laravel app from github then I ran composer install on the root folder of the app and all vendors installed. however I still can not execute php artisan list on the app root folder
I tried also this command
composer global require "laravel/installer=~1.1"
but same problem also there is no laravel folder installed inside vendor folder. I dont know what laravel version used with this web app
So how I can make php artisan work ?
Update:
I opened composer.json file and I found no Laravel frame work to install !! should I return to the developer who made this or I just add Laravel package to composer.json and run composer install again ? if so what I should add to the composer.json ? I dont know which version to install !!
Your project has to have an artisan file in the root directory, otherwise the php artisan command won't work.
I had a similar issue. Fixed it by using the following command, which results in a clean installation.
composer create-project --prefer-dist laravel/laravel my-project
If errors occur, your CLI will show them.
Docs

php artisan commands stop working after composer update in laravel 5.1

I was adding the html Collective class by updating composer.json with
"require": {
"laravelcollective/html": "5.1.*"
}
then I run composer update command as per the instructions from https://laravelcollective.com/docs/5.1/html first it throws a
Fetal error: Class 'Illuminate\Foundation\Application' not found in C:\wamp\www\laravel3\laravel\bootstrap\app.php on line 14
and some errors about artisan and now artisan commands are not working, even I have tried new installation of laravel.
In order to use form and html in blade template I was trying to install Collective class using the instructions of https://laravelcollective.com/docs/5.1/html site, as per instructions I put "require": { "laravelcollective/html": "5.1.*" } into composer.json and then I ran composer update in command line which didn't update my composer, instead php artisan commands stop working and I receive different errors and exceptions, to solve those issues I struggle with commands such as composer update --no-scripts, php artisan clear-compiled, composer dump-autoload etc. which didn't solve the issue at all. Then I just type following command in command line: composer require "laravelcollective/html": "5.1.*", it update composer.json file automatically, after this process I just add providers and aliases into config/app.php, and now every thing works normal.
Okay, I suspect that the composer is not updated properly. Try doing composer update now with
composer update --no-scripts
followed by,
php artisan clear-compiled
composer dump-autoload
Try composer installation again then update.
composer install
composer update
composer dumpautoload -o
This happens when an update is not completed successfully.

Laravel 4 PHP Fatal error: Class 'Monolog\Formatter\LineFormatter' not found in bootstrap/compiled.php on line 7991

I haven't used composer or Laravel 4 during the last couple of weeks, today I created a new Laravel project and suddenly Monolog is causing a ton of problems.
At first I was unable to fully create the project, afterwards I was unable to create a migration, and now I can't run php artisan serve any more. I followed the steps on Laravel 4 Class not found in bootstrap/compiled.php and that helped the first time around, but after creating the second migration and wanting to run a php artisan migrate I get the following error:
PHP Fatal error: Class 'Monolog\Formatter\LineFormatter' not found in /bootstrap/compiled.php on line 7991
How do I fix this?
I have update composer using self-update, I have tried to use dump-autoload, and the other steps in the question I posted a link to.
I solved this issue by deleting the vendorfolder and then running a composer install to ensure a fresh install of all packages in the composer.json.
I'm not sure how you installed the project. If you're trying to impose Laravel 4 over an old project, I suggest you to install FRESH Laravel using this command
composer create-project laravel/laravel project_name --prefer-dist
This should not give you any installation related problem unless the Laravel installation itself is broken. Which is very unlikely to happen.
You can then copy your controllers, models, migrations etc from the old project.
Good luck.

Class 'Monolog\Logger' not found, installation error in Laravel 4

I installed Laravel without using composer with typing this command:
C:\wamp\www\travail>laravel new project
It seems that it is on the good way.
Creating application...
Application ready! Build something amazing.
But when I tried to open my project here:
wamp-->localhost-->travail-->project-->public
I got this error:
Class 'Monolog\Logger' not found
I solve this issue by doing the following:
Check the minimum-stability value in composer.json and set it to stable:
"minimum-stability": "stable"
Update you composer:
composer self-update
Re-run composer udpate:
composer update
Then run any artisan commands and enjoy coding!
According to this thread. Change minimum-stability from dev to stable in composer.json, then run an update. Also try to do a dump-autoload.
Finally it works for me after running these two commands:
composer self-update
Then:
composer update --no-scripts

Resources