I have checked out many examples of this but for some reason, either I am missing an assumed step or I'm just doing it wrong.
So I am having issues getting Laravel installed locally. I have a composer.json
and .phar file.
I have ran php composer install
which downloaded the dependencies. However, this is where it gets different. Seems at this point all the examples I have found are magically working. However in mine, I have a vendor directory with all the dependencies but nothing is actually installed. I have the Laravel source but its not ready for development yet.
Does this make sense? Am I over complicating things?
I am now getting an error:
Script php artisan optimize handling the post-update-cmd event returned with error code 1
which after checking, that method is there...
My composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"barryvdh/laravel-cors": "^0.8.2"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
It looks like you may have downloaded Laravel itself instead of creating a Laravel project.
The Installing Laravel section of the documentation shows two ways to create a Laravel project:
Via Laravel Installer
First, download the Laravel installer using Composer:
composer global require "laravel/installer"
Make sure to place the
$HOME/.composer/vendor/bin
directory (or the equivalent directory for your OS) in your$PATH
so thelaravel
executable can be located by your system.Once installed, the
laravel new
command will create a fresh Laravel installation in the directory you specify. For instance,laravel new blog
will create a directory namedblog
containing a fresh Laravel installation with all of Laravel's dependencies already installed:laravel new blog
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer
create-project
command in your terminal:composer create-project --prefer-dist laravel/laravel blog
After doing either of these your project directory should include the proper Laravel directories with all dependencies properly set up.