Skip to content

Latest commit

 

History

History
113 lines (83 loc) · 4.13 KB

File metadata and controls

113 lines (83 loc) · 4.13 KB
title Installation
description Create your first Laravel Zero application

Installation

Requirements

Laravel Zero has a few system requirements. Before creating your first application, make sure that your local machine meets the following:

If you intend to distribute your application as a PHAR archive, the sodium PHP extension is also required, since it is used by Box to compile the archive.

Creating an Application

Laravel Zero utilizes Composer to manage its dependencies. You may create a new application by issuing the Composer create-project command in your terminal:

composer create-project --prefer-dist laravel-zero/laravel-zero movie-cli

Naming Your Application

A fresh application is executed via a binary named application. Once your project has been created, you should run the app:rename command to give the binary a name of your own:

cd movie-cli

php application app:rename movie-cli

This command renames the binary at the root of your project and updates the bin entry within your composer.json file. From this point forward, all of the examples in this documentation that reference php application should be invoked using your own application's name instead:

php movie-cli inspire

Note: If you invoke app:rename without providing a name, Laravel Zero will prompt you for one.

Directory Structure

Laravel Zero applications are intentionally small. A fresh installation looks like this:

├── app
│   ├── Commands
│   │   └── InspireCommand.php
│   └── Providers
│       └── AppServiceProvider.php
├── bootstrap
│   ├── app.php
│   └── providers.php
├── config
│   ├── app.php
│   └── commands.php
├── tests
├── application
├── box.json
└── composer.json
Path Description
app/Commands Your application's commands. Every command in this directory is registered automatically.
app/Providers Your application's service providers.
bootstrap/app.php Creates the application instance.
bootstrap/providers.php The list of service providers loaded by your application.
config Your application's configuration files.
tests Your application's Pest tests.
application The binary used to invoke your commands.
box.json The Box configuration used when building your application.

Directories such as database, resources, and storage are not present in a fresh installation. They are created for you when you install the component that needs them.

Running Your Application

To view a list of all of the commands available to your application, run the binary without any arguments:

php application

A fresh application ships with a single example command. Let's run it:

php application inspire

Every command also includes a "help" screen which displays and describes the command's available arguments and options:

php application help inspire

Next Steps

Your application is ready. Now, head over to the commands documentation to write your first command, or browse the configuration documentation to learn how to customize your application's name, version, and command list.