How to Use the Command 'lambo new' (with Examples)

How to Use the Command 'lambo new' (with Examples)

The lambo new command is a powerful tool for setting up new Laravel applications quickly and efficiently. Building on the traditional laravel new command, it integrates beautifully with Laravel and Valet environments, allowing developers to streamline their workflow and enhance productivity. Created by Tighten, the tool simplifies the initial setup of Laravel applications by offering numerous customization options, which automate several common tasks.

Use Case 1: Create a New Laravel Application

Code:

lambo new app_name

Motivation: Creating a new Laravel application is the foundational step for any development project using the Laravel framework. This command simplifies the setup process by automatically preparing a new Laravel environment, establishing a base from which developers can start building their applications.

Explanation:

  • lambo: This is the command itself, used to initiate Lambo’s functionalities.
  • new: This indicates that a new project setup is being initiated.
  • app_name: This specifies the name of the new Laravel application you wish to create.

Example Output:

Creating a new Laravel application named 'app_name'.
Application 'app_name' has been successfully created.

Use Case 2: Install the Application in a Specific Path

Code:

lambo new --path=path/to/directory app_name

Motivation: When working in environments where organization is key, specifying a particular installation directory for an application can be crucial. This ensures that Laravel projects are not only created but stored in a logical, predefined location, helping teams keep their directories clean and navigable.

Explanation:

  • --path=path/to/directory: This flags that a specific path is provided where the application should be installed. Replace “path/to/directory” with your desired directory path.
  • app_name: The name of the application you’re creating.

Example Output:

Installing Laravel application 'app_name' in path/to/directory.
Application 'app_name' has been created successfully at path path/to/directory.

Use Case 3: Include Authentication Scaffolding

Code:

lambo new --auth app_name

Motivation: Authentication is a common feature in many web applications. Including authentication scaffolding from the start can save developers time and effort by setting up fundamental user login and registration functionalities automatically.

Explanation:

  • --auth: This option automatically includes Laravel’s Authentication scaffolding into the new application.
  • app_name: The name given to the new application.

Example Output:

Creating Laravel application 'app_name' with authentication scaffolding.
Application 'app_name' is ready with authentication features included.

Use Case 4: Include a Specific Frontend

Code:

lambo new --vue app_name

(or)

lambo new --bootstrap app_name

(or)

lambo new --react app_name

Motivation: Different projects may require different frontend technologies, such as Vue, Bootstrap, or React. This option allows developers to seamlessly integrate their chosen frontend framework from the very beginning of the project, ensuring a cohesive development process tailored to project requirements.

Explanation:

  • --vue|bootstrap|react: Specifies which frontend framework to include in the new application setup.
  • app_name: The name of the new application being created.

Example Output:

Creating Laravel application 'app_name' with Vue.js integrated.
Application 'app_name' is ready with the Vue.js frontend.

Use Case 5: Install npm Dependencies After the Project has Been Created

Code:

lambo new --node app_name

Motivation: Installing node modules is integral to working with JavaScript and its associated tools. By enabling this option, developers can ensure that all necessary npm dependencies are installed immediately after setup, helping to jumpstart the development process without a delay in configuring module dependencies.

Explanation:

  • --node: This flag commands automatic installation of npm dependencies post-creation.
  • app_name: The desired name for the Laravel application.

Example Output:

Creating Laravel application 'app_name'.
Installing npm dependencies...
All npm dependencies for 'app_name' have been installed.

Use Case 6: Create a Valet Site After the Project has Been Created

Code:

lambo new --link app_name

Motivation: In development environments like Laravel Valet, linking a project to Valet simulates a production server environment on your local machine. This can help streamline testing and development by creating an accurate development space that behaves similarly to a deployed site.

Explanation:

  • --link: Instructs Lambo to create a Valet link, establishing a Valet domain for the project.
  • app_name: Name of the project being linked with Valet.

Example Output:

Creating Laravel application 'app_name'.
Linking 'app_name' with Laravel Valet.
Valet link created for 'app_name'.

Use Case 7: Create a New MySQL Database with the Same Name as the Project

Code:

lambo new --create-db --dbuser=user --dbpassword=password app_name

Motivation: Automatically creating a MySQL database during project setup ensures that database configurations are in place before development begins. This helps in maintaining convention-over-configuration, smoothing the path for database-related implementations and seed data testing.

Explanation:

  • --create-db: Indicates that a new MySQL database should be created.
  • --dbuser=user: Specifies the database user (replace “user” with the actual username).
  • --dbpassword=password: Provides the necessary password for the specified database user (replace “password” with the actual password).
  • app_name: The name of the application, consequently also the name of the database.

Example Output:

Creating Laravel application 'app_name'.
Setting up a MySQL database named 'app_name'.
Database 'app_name' has been successfully created.

Use Case 8: Open a Specific Editor After the Project has Been Created

Code:

lambo new --editor="editor" app_name

Motivation: Developers usually have a preferred code editor or an IDE that they are most comfortable with. By opening the project immediately in this environment post-setup, developers can start coding straight away, saving the time of manual navigation and setup.

Explanation:

  • --editor="editor": Indicates the choice of the code editor to automatically open once the project has been set up. Replace “editor” with your preferred code editor, i.e., “vscode”, “sublime”.
  • app_name: The name given to the new Laravel project.

Example Output:

Creating Laravel application 'app_name'.
Opening 'app_name' in editor.
'App_name' is now open in your selected code editor.

Conclusion:

The lambo new command provides a robust suite of options that optimize the creation of Laravel applications. By automating many routine setup tasks, developers can save significantly on time while maintaining an organized and efficient workflow. Each option serves to simplify and enhance the development experience, allowing teams and individual developers to focus more on the unique aspects of their projects rather than setup intricacies.

Related Posts

How to use the command 'lex' (with examples)

How to use the command 'lex' (with examples)

The ’lex’ command is a lexical analyzer generator that is used to generate C code for implementing a lexical analyzer based on a given specification.

Read More
How to Use the Command 'stylua' (with examples)

How to Use the Command 'stylua' (with examples)

Stylua is an opinionated code formatter for the Lua programming language.

Read More
How to Use Input Redirection with the Less Than Symbol (with Examples)

How to Use Input Redirection with the Less Than Symbol (with Examples)

In the world of command-line environments, input and output redirection plays a crucial role by allowing users to direct the flow of data into and out of commands.

Read More