composer global require laravel-hub-cli/laravel-hub
composer global update laravel-hub-cli/laravel-hub
You can use the CLI as a near drop-in replacement for the offical Laravel installer. For example:
laravel-hub new project
But the real power of the tool is when you create a compose
file. The compose
file is your basic recipe for your application. You should create an app.yaml
file in the directory where you would like to create your application.
touch app.yaml
When you are done crafting your recipe (see docs below), you should run the compose
command:
laravel-hub compose {script=app.yaml}
If your compose
file is named something other than app.yaml
, pass the name of your file as the first argument.
- env
- git
- name
- touch
- mkdir
- artisan
- console
- version
- blueprint
- php-packages
- php-packages-dev
- npm-packages
- npm-packages-dev
The env
API allows you update or insert (upsert) keys in the applications .env
file.
An example is show below:
env:
APP_NAME: "Laravel"
DB_DATABASE: "laravel"
NEW_ENV_KEY: "value"
The git
API allows you to signal that you would like a git repository to be created and commits to be made for each step. The possible values are: true
or false
An example is show below:
git: true
- Required: True
The name
key is required, the sluggified version of the name will be used to generate the folder name where the application will be installed.
The touch
API allows you create files in your application. Any required directories will also be created.
An example is show below:
touch:
- "app/Support/helpers.php"
The mkdir
API allows you create directories in your application. Any required parent directories will also be created.
An example is show below:
mkdir:
- "resources/svg"
The artisan
API allows you run Laravel Artisan commands in your application.
An example is show below:
artisan:
- storage:link
- make:model Post -mfc
The console
API allows you create run console commands in your application.
An example is show below:
console:
- git init
- code .
The version
API allows you to declare what version of Laravel you want to install. You can specify any valid composer version.
An example is show below:
version: "7.x"
The blueprint
API is an special key. It installs the powerful Laravel Blueprint package as a dev dependency. It then take the value of the key and writes this to a draft.yaml
file in your project. This allows you to scaffold anything that the Laravel Blueprint package can create.
An example is show below:
blueprint:
models:
Post:
title: string:400
content: longtext
published_at: nullable timestamp
author_id: id:user
controllers:
Post:
index:
query: all
render: post.index with:posts
store:
validate: title, content, author_id
save: post
send: ReviewPost to:post.author.email with:post
dispatch: SyncMedia with:post
fire: NewPost with:post
flash: post.title
redirect: post.index
The php-packages
API allows you require composer packages into your application.
An example is show below:
php-packages:
- laravel/telescope
- laravel/socialite
The php-packages-dev
API allows you require dev only composer packages into your application.
An example is show below:
php-packages-dev:
- brianium/paratest
The npm-packages
API allows you install NPM packages into your application.
An example is show below:
npm-packages:
- "tailwindcss/@latest"
The npm-packages
API allows you install NPM dev packages into your application.
An example is show below:
npm-packages-dev:
- "alpinejs"
This basic recipe will simply create a new Laravel application and set some env
values
name: "Basic Laravel Recipe"
env:
APP_NAME: "Basic Recipe"
DB_DATABASE: "basic"
This advanced recipe will create a new Laravel application and then clone a existing repo and copy some files into your new application. And then launch the app with VS Code.
name: "Advanced Laravel Recipe"
env:
APP_NAME: "Advanced Recipe"
DB_DATABASE: "advanced"
console:
- git clone "https://github.com/WyattCast44/laravel-starter-app-tall" "source"
- cp -R "source/resources/views" "resources"
- cp "source/routes/auth.php" "routes/auth.php"
- rm -rf "source"
- code .