Super-powered laravel new for Laravel and Valet
Lambo is a command-line tool that replaces the Laravel installer and wraps up the most common tasks you might take when creating a Laravel app: opening it in your editor and your browser, initialize a git repository, tweak your .env and .env.example, and more.
- PHP 7.3+
- (optional, but beneficial) Laravel Valet
composer global require tightenco/lambo:^3.0composer global update tightenco/lamboMake sure ~/.composer/vendor/bin is in your terminal's path.
cd ~/Sites
lambo new myNextProjectlaravel new $PROJECTNAME- Initialize a git repo, add all the files, and, after some changes below, make a commit with the text "Initial commit."
- Replace the
.env(and.env.example) database credentials with the default macOS MySQL credentials: database of$PROJECTNAME, userroot, and empty password - Replace the
.env(and.env.example)APP_URLwith$PROJECTNAME.$YOURVALETTLD - Generate an app key
- Open the project in your favorite editor
- Open
$PROJECTNAME.$YOURVALETTLDin your browser
Note: If your
$PROJECTNAMEhas dashes (-) in it, they will be replaced with underscores (_) in the database name.
There are also a few optional behaviors based on the parameters you pass (or define in your config file), including creating a database, migrating, installing Jetstream, running Valet Link and/or Secure, and running a custom bash script of your definition after the fact.
While the default actions Lambo provides are great, most users will want to customize at least a few of the steps. Thankfully, Lambo is built to be customized!
There are three ways to customize your usage of Lambo: command-line arguments, a config file, and an "after" file.
Most users will want to set their preferred configuration options once and then never think about it again. That's best solved by creating a config file.
But if you find yourself needing to change the way you interact with Lambo on a project-by-project basis, you may also want to use the command-line parameters to customize Lambo when you're using it.
You can create a config file at ~/.lambo/config rather than pass the same arguments each time you create a new project.
The following command creates the file, if it doesn't exist, and edits it:
lambo edit-configThe config file contains the configuration parameters you can customize, and will be read on every usage of Lambo.
You can also create an after file at ~/.lambo/after to run additional commands after you create a new project.
The following command creates the file, if it doesn't exist, and edits it:
lambo edit-afterThe after file is interpreted as a bash script, so you can include any commands here, such as installing additional composer dependencies...
# Install additional composer dependencies as you would from the command line.
echo "Installing Composer Dependencies"
composer require tightenco/mailthief tightenco/quicksand...or copying additional files to your new project.
# To copy standard files to new lambo project place them in ~/.lambo/includes directory.
echo "Copying Include Files"
cp -R ~/.lambo/includes/ $PROJECTPATHYou also have access to variables from your config file such as $PROJECTPATH and $CODEEDITOR.
Any command-line parameters passed in will override Lambo's defaults and your config settings. See a full list of the parameters you can pass in.
helporhelp-screenshow the help screen
-
edit-configedits your config file (and creates one if it doesn't exist)lambo edit-config
-
edit-afteredits your "after" file (and creates one if it doesn't exist)lambo edit-after
You can optionally pass one or more of these parameters every time you use Lambo. If you find yourself wanting to configure any of these settings every time you run Lambo, that's a perfect use for the config files.
-
-eor--editorto define your editor command. Whatever is passed here will be run as$EDITOR .after creating the project.# runs "subl ." in the project directory after creating the project lambo new superApplication --editor=subl -
-por--pathto specify where to install the application.lambo new superApplication --path=~/Sites -
-mor--messageto set the first Git commit message.lambo new superApplication --message="This lambo runs fast!" -
-for--forceto force install even if the directory already exists# Creates a new Laravel application after deleting ~/Sites/superApplication lambo new superApplication --force -
-dor--devto choose thedevelopbranch instead ofmaster, getting the beta install.lambo new superApplication --dev
-
-bor--browserto define which browser you want to open the project in.lambo new superApplication --browser="/Applications/Google Chrome Canary.app" -
-lor--linkto create a Valet link to the project directory.lambo new superApplication --link
-
-sor--secureto secure the Valet site using https.lambo new superApplication --secure
-
--create-dbto create a new MySQL database which has the same name as your project. This requiresmysqlcommand to be available on your system.lambo new superApplication --create-db
-
--migrate-dbto migrate your database.lambo new superApplication --migrate-db
-
--dbuserto specify the database username.lambo new superApplication --dbuser=USER
-
--dbpasswordspecify the database password.lambo new superApplication --dbpassword=SECRET
-
--dbhostspecify the database host.lambo new superApplication --dbhost=127.0.0.1
-
--breeze=STACKto use the Laravel Breeze starter kit.STACKmay be eitherblade,vueorreact.lambo new superApplication --breeze=blade lambo new superApplication --breeze=vue lambo new superApplication --breeze=react
-
--jetstream=STACK[,teams]to use the Laravel Jetstream starter kit.STACKmay be eitherinertiaorlivewire.lambo new superApplication --jetstream=inertia lambo new superApplication --jetstream=inertia,teams lambo new superApplication --jetstream=livewire lambo new superApplication --jetstream=livewire,teams
-
--fullto use--create-db,--migrate-db,--link, and-secure.lambo new superApplication --full
GitHub Repository Creation
Important: To create new repositories Lambo requires one of the following tools to be installed:
- the official GitHub command line tool
- the hub command line tool
Lambo will give you the option to continue without GitHub repository creation if neither tool is installed.
-gor--githubto Initialize a new private GitHub repository and push your new project to it.
# Repository created at https://github.com/<your_github_username>/superApplication
lambo new superApplication --github- Use
--gh-publicwith--githubto make the new GitHub repository public.
lambo new superApplication --github --gh-public- Use
--gh-descriptionwith--githubto initialize the new GitHub repository with a description.
lambo new superApplication --github --gh-description='My super application'- Use
--gh-homepagewith--githubto initialize the new GitHub repository with a homepage url.
lambo new superApplication --github --gh-homepage=https://example.com- Use
--gh-orgwith--githubto initialize the new GitHub repository with a specified organization.
# Repository created at https://github.com/acme/superApplication
lambo new superApplication --github --gh-org=acmeIf you're working with us and are assigned to push a release, here's the easiest process:
-
Visit the Lambo Releases page; figure out what your next tag will be (increase the third number if it's a patch or fix; increase the second number if it's adding features)
-
On your local machine, pull down the latest version of
main(git checkout main && git pull) -
Build for the version you're targeting (
./lambo app:build) -
Run the build once to make sure it works (
./builds/lambo) -
Commit your build and push it up
-
Draft a new release with both the tag version and release title of your tag (e.g.
v1.5.1) -
Set the body to be a bullet-point list with simple descriptions for each of the PRs merged, as well as the PR link in parentheses at the end. For example:
- Add a superpower (#92) -
Hit
Publish release -
Profit
- All new configuration keys must be added to the
$newConfigurationproperty inUpgradeSavedConfiguration - All removed or deprecated configuration keys must be added to the
$removedConfigurationKeysproperty inUpgradeSavedConfiguration - Any time configuration keys are changed, the
$configurationVersionproperty inUpgradeSavedConfigurationneeds to be incremented