That means all dependencies are installed and your application is ready!
Installing Laravel Through Composer
How can I install a new project where it automatically installs all the composer dependencies as such in the following video because when I do it all it says is ...
https://laracasts.com/series/laravel-5-from-scratch/episodes/1
Me-iMac:repositories me$ laravel new project
Crafting application...
Application ready! Build something amazing.
But they aren't because to do that I have to run composer install after I run laravel new. So I'm trying to figure out why I have to do that separate.
I ask this because in the video on @JeffreyWay runs the command ontop of it installing the dependencies his also creates the key and makes a copy of the .env.example file among other things so for some reason my installer isn't performing the same tasks as his. I know some of this are minor but I'm curious as to why this is. What did I do differently to have my installer run the same command differently?
He may have set up an alias to do that, mine does that so it could (a) be from an older video that I have modified the laravel new command or (b), you have modified the laravel new command to behave differently. Sorry I can't remember if I changed something, I know I created a custom command ages ago that did a bunch of extra stuff after creating a project.
Check your .bashrc, .bash_aliases, and .bash_profile files.
Update
I just checked and this is the alias that I put together a couple of years ago:
alias new='function _create_new_laravel_5_project(){ cd ~/Code/Laravel; laravel new "$1"; echo "created project $1"; cd $1; subl .;};_create_new_laravel_5_project'
What the above does:
- creates an alias
new -
cdinto my~/Code/laraveldirectory - creates a new laravel project
- tells me it has been created
-
cdinto that project - opens the project in sublime
So... based on that, the laravel new command does install composer dependencies automatically. Not sure why yours doesn't.
I just tried a new project now and i got all dependencies installed too with
laravel new testvel

@Mo7sin Did you have an alias set up for additional commands because not only did I not get dependencies initially installed when I ran the command but no copy of the .env.example file was made or app key generated.
@xtremer360 what version of the command are you using?
Maybe do a global composer update.
Check your ~/.composer directory for the laravel command. You can see your composer.json file here.
My composer.json file looks like:
{
"require": {
"laravel/installer": "^1.3"
}
}
@mstnorris Here's my composer.json file.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"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"
}
}
Not your project's composer.json file, your global composer.json file.
Are you on a Mac, Windows, or Linux machine?
I'm on a Mac, and my global composer install is located in my "home" (~/) directory, within a ".composer" directory.
I'm trying to figure out how to open that into my code editor since it's hidden.
Change directory to that using the command line, and either issue the command nano to open it, or cat just to view it. You didn't answer my question, but I'm presuming you're on a Mac and it is hidden.
Open the file (not necessary)
nano ~/.composer/composer.json
Or, if you just want to view it.
cat ~/.composer/composer.json
Me-iMac:.composer me$ cat composer.json
{
"require": {
"laravel/installer": "~1.1",
"laravel/homestead": "^3.0"
}
}
There you go, update your laravel installer to 1.3 as per mine above, then you should get the latest features.
- Manually change it to 1.3
- Then run
composer updatefrom that directory (~/.composer)
Do I just edit the composer.json file to 1.3 and then run the update command and that's it?
Yep :) Give it a go.
So I did that and for some reason it won't find the file even though it exists because I just changed the value.
Me-iMac:~ me$ composer update
Composer could not find a composer.json file in /Users/me
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Me-iMac:~ me$ composer
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.1.2 2016-05-31 19:48:11
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
about Short information about Composer
archive Create an archive of this composer package
browse Opens the package's repository URL or homepage in your browser.
clear-cache Clears composer's internal package cache.
clearcache Clears composer's internal package cache.
config Set config options
create-project Create new project from a package into given directory.
depends Shows which packages cause the given package to be installed
diagnose Diagnoses the system to identify common errors.
dump-autoload Dumps the autoloader
dumpautoload Dumps the autoloader
exec Execute a vendored binary/script
global Allows running commands in the global composer dir ($COMPOSER_HOME).
help Displays help for a command
home Opens the package's repository URL or homepage in your browser.
info Show information about packages
init Creates a basic composer.json file in current directory.
install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
licenses Show information about licenses of dependencies
list Lists commands
outdated Shows a list of installed packages that have updates available, including their latest version.
prohibits Shows which packages prevent the given package from being installed
remove Removes a package from the require or require-dev
require Adds required packages to your composer.json and installs them
run-script Run the scripts defined in composer.json.
search Search for packages
self-update Updates composer.phar to the latest version.
selfupdate Updates composer.phar to the latest version.
show Show information about packages
status Show a list of locally modified packages
suggests Show package suggestions
update Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
validate Validates a composer.json and composer.lock
why Shows which packages cause the given package to be installed
why-not Shows which packages prevent the given package from being installed
Me-iMac:~ me$ composer update
Composer could not find a composer.json file in /Users/me
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Me-iMac:~ me$
You're in the wrong directory. Look at the top line:
Me-iMac:~ me$ composer update <-- You're running the command from your "home" directory, i.e your name, mine is Mike (/Users/Mike/)
You need to change directory into your ~/.composer directory.
-
cd ~/.composer - run
composer update
Yikes
I'm sorry I just though since composer was global that well nvm I guess I didn't understand.
@mstnorris However.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package laravel/installer ~1.31 exists as laravel/installer[dev-master, dev-revert-35-master, v1.1.0, v1.1.1, v1.1.2, v1.1.3, v1.2.0, v1.2.1, v1.2.2, v1.3.0, v1.3.1, v1.3.2, v1.3.3] but these are rejected by your constraint.
No problem, it's an easy mistake to make, yes composer is global, but to run the command globally you need to issue the global flag. Like so:
composer global update
What did you change your composer.json file to be? Can you paste it here.
"require": {
"laravel/installer": "~1.31",
"laravel/homestead": "^3.0"
}
Nevermind I was a goof.
What did you do? ;)
1.31 instead of 1.3.
Hope it is sorted now.
First of all, you need to follow the steps to properly install the Laravel installer as you can see in the official documentation.
You could create a function in bash to do all you need with a single command
Basically this function creates a new project, initializes a new local repository with git, changes the environment variables on the .env file, open the browser with this project and finally opens sublime with this project.
This works with Laravel valet but you could tweak it a little to make it work in homestead instead of valet
function newproject {
PROJECT=$1
echo "Creating a new Laravel project: $PROJECT..."
cd ~/code
laravel new $PROJECT
cd $PROJECT
git init
git add .
git commit -m "Install Laravel"
mysql -u root -e "CREATE DATABASE $PROJECT"
replace "DB_DATABASE=homestead" "DB_DATABASE=$PROJECT" -- .env
replace "DB_USERNAME=homestead" "DB_USERNAME=root" -- .env
replace "DB_PASSWORD=secret" "DB_PASSWORD=" -- .env
open "http://$PROJECT.dev"
subl .
echo "$PROJECT project created succesfully"
}
Same version here.
{
"require": {
"laravel/valet": "^1.0",
"laravel/installer": "^1.3"
}
}
Please or to participate in this conversation.