1

I want to create a bash shell function to create a new laravel 5 project by passing in the app name as an argument.

This is what I have so far:

function new {
    composer create-project laravel/laravel $1 dev-develop --prefer-dist
}

I call it by new project-name

However I get this error:

[UnexpectedValueException] Could not parse version constraint hawksmoorcs: Invalid version string "project-name"

Michael
  • 4,282
  • 9
  • 55
  • 89

1 Answers1

1

I found the answer by following Thomas Bratts's answer to this question.

alias new='function _create_new_laravel_5_project(){ composer create-project laravel/laravel "$1" dev-develop --prefer-dist; echo "created project $1";};_create_new_laravel_5_project'

You can call it using new name-of-laravel-5-project

Perfect!

Community
  • 1
  • 1
Michael
  • 4,282
  • 9
  • 55
  • 89