how to make php artisan command available? - laravel

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

Related

Can not download Laravel UI package

I want to download Laravel UI package via composer and I have got this error
Seems like due to internet issue you can't access packagists site (which composer uses to get the packages) which is causing the installation to fail.
run a fresh composer create-project laravel/laravel command, copy replace your composer.json content with the old projects composer.json. Do the same with .env file
and run composer install. then u can run "composer require/laravel/ui"

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 Uninstall Laravel?

I am facing fatal errors regarding Artisan. I think I couldn't install laravel complete due to slow internet. Now I want to remove Laravel from root and want to have fresh installation.
Can anyone help me?
if you have installed it globally you can simply remove it by composer global remove laravel/installer
If you have installed it via composer project you simply remove the directory.
Since I was looking all around how to uninstall packages and after reading tones
of documentations here's the short how-to uninstall a workbench package in Laravel
Remove package service provider from 'providers' array in app/config/app.php
Remove the package folder in workbench/
Run:
php composer.phar dump-autoload
php artisan clear-compiled
php artisan optimize
(optional) remove all related code using the package (you'll get errors about that)
or use composer global remove laravel/installer
For me, the command that actually did the trick was: composer global remove laravel/installer

Cannot install Laravel correctly

I followed all the instruction by installing composer and then Laravel. Also I did everything what was shown in laracast series for installing Laravel and composer.
BUT I have some problems and I cannot solve them:
I don't have Vendor folder in my Laravel app folder
I cannot launch command 'composer artisan' as it says that
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "artisan" is not defined"
"php artisan" also doesn't work
All the answer in the web I have already tried to resolve my problems but nothing worked for me
Please, tell me, how can I install Laravel correctly and use it without errors
Run composer install or composer update. This will create the vendor folder and download all the dependent modules as mentioned in the composer.json
I want to add some more details which are asked but not clearly answered.
You did not install the composer dependencies. Try composer install.
It is not composer artisan. If you execute that command, you say hey composer! run your artisan command. And it says "Command "artisan" is not defined."
It is php artisan. But if you don't run composer install, php artisan will not work either. Because you are missing Symfony Console Component in your project (not the one used by composer) as well as a complete Laravel installation. Both will also be installed by the composer install command.
Well. I've solved my problem. As I mentioned before I had tried all the answer in the web but nothing had helped me. So then I just deleted my laravel project and ran this command
sudo apt-get upgrade
After some time packages were upgraded and I created new Laravel project. And Laravel started working perfectly! So in any incomprehensible situation do apt-get upgrade :))

Install Laravel using Composer

I'm trying to install Laravel using Composer, but after running the following command
composer create-project laravel/laravel cmsLaravel 5.2
pointing to my c/xampp/htddocs directory, I get the error below:
C:\xampp\htdocs\laravelCMS\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravelCMS\bootstrap\autoload.php on line 17
To install Laravel using composer, all you need to do is to run in your terminal is:
composer create-project --prefer-dist laravel/laravel blog
Where: blog is the name of the folder containing your new Laravel instance.
To install Laravel directly within your chosen directory (not in a folder within it as demonstrated above), simply run the same command but this time without a folder name as in:
composer create-project --prefer-dist laravel/laravel
Remember to run the command within your desired directory for the project; in your case, for C:\xampp\htdocs\, then, run either the first or second command as above base on your needs.
This assumes you already have Composer properly installed as recommended on their website.
Before you try addressing your failed to open stream: error, do avoid having folder names with space(s) as in your command above (obviously not the source of the error).
Make sure you have the correct Server Requirements for Laravel
the failed to open stream: error usually occur when the OpenSSL PHP Extension not enabled.
PHP >= 5.6.4
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
After enabling the required extension(s), do remember to restart your server, then run the following command:
composer update
Follow the steps below;
Download and install Composer.
Go inside the folder C:\xampp\htdocs>(if you are using xampp) or C:\wamp\www>(if you are using wamp) and open cmd/PoweShell & run the following commands:
composer global require "laravel/installer"
composer create-project laravel/laravel (after running this command a folder having name Laravel will be created there)
Now go inside Laravel folder and run php artisan serve command.
After executing the last cmd, it will show an URL: http://127.0.0.1:8000; access the URL in a browser, which should reflect the will see the default webpage of Laravel.
Download and install composer
Run composer global require "laravel/installer"
Open terminal inside C:\xampp\htdocs and run laravel new my_folder_name
You can just run
composer install
and it will process the required files to load the laravel in web browser
EDIT:
After seeing your comment, you should go to your laravel directory in your cmd.
cd C:\xampp\htdocs\laravelCMS
and run the command
composer install
Change your command to this:
composer create-project laravel/laravel cmsLaravel 5.2.*
This mean any sub version of laravel 5.2.
Check your index.php and Change the path as per your project directory
Register The Auto Loader
require __DIR__.'/cmsLaravel /vendor/autoload.php';
$app =require_once __DIR__.'/cmsLaravel /bootstrap/app.php';
composer create-project laravel/laravel 6.0
composer is a tool for dependency management in PHP
create-project is command to create a new laravel project
laravel/laravel is for the skeleton application you get when creating a new project. It provides a default structure that's recommended (you're not forced to use it). The repository contains default config files, controllers, routes, etc. As well as code responsible for bootstrapping the application.
Link Laravel/laravel
6.0 Version in laravel
just run your command line as admin
it worked for me
Please follow this step and try it
step 1
composer create-project laravel/laravel example-app
step 2
composer global require laravel/installer
laravel new example-app
step 3
cd example-app
php artisan serve
Else I will Recommend You To Go in to laravel offical page
Clik Here

Resources