Overview
The Assegai CLI is a command-line tool that can help you create, develop, and maintain Assegai applications. It provides assistance in various ways, including generating the initial project structure, serving the app in development mode, and creating a production-ready build of the application. It follows best practices in application architecture to encourage the development of well-structured apps.
Requirements
Installing the Assegai CLI is easy and straightforward, but there are a few requirements that need to be met before you can get started. Below, you'll find all the information you need to get up and running with the Assegai CLI.
First and foremost, you'll need to have Composer installed on your system. Composer is a dependency manager for PHP, and it is used to install the Assegai CLI and all its dependencies. If you don't have Composer installed already, you can download it from the official website.
In addition to Composer, you'll also need to have the following PHP extensions enabled on your system:
curl
, pdo
, and json
. These extensions are required for the Assegai CLI
to function properly, and they must be enabled before you can proceed with the installation. If you're not
sure if these extensions are enabled, you can check by running the following command:
$ php -m
This will display a list of all the extensions that are currently loaded in your PHP environment. Look for
curl
, pdo
, and json
in the list, and make sure they are marked as
'enabled'. If they are not, you'll need to enable them before you can proceed with the installation.
Once you have met these requirements, you're ready to proceed with the installation of the Assegai CLI.
Installation
Command line installation
-
Install the Assegai Console globally using Composer:
$ composer global require assegaiphp/console
-
Add the Composer bin directory to your PATH to make the assegai command available globally:
$ ln -s ~/.config/composer/vendor/bin/assegai /usr/local/bin/assegai
-
Alternatively, you can add the Composer bin directory to your $PATH to make assegai available globally. To do so, add the following line to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, etc.):
$ export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Note: The path to the Composer bin directory may vary depending on your system configuration. Please refer to the official Composer documentation for more information.
For macOS, you can use the same instructions as for Linux.
Note: The following instructions are for Windows 10/11. If you are using an older version of Windows, please refer to the official Composer documentation for installation instructions.
For Windows, you can use WSL (Windows Subsystem for Linux) to install the Assegai Console. Then simply follow the instructions for Linux.
Basic workflow
After installing the Assegai CLI, you can use it to run commands directly from your operating system's terminal using the assegai
executable. To see a list of available assegai
commands, enter the following in your terminal:
$ assegai --help
To get help on a specific command, use the following structure. Replace "generate" in the example below with the command you want to learn more about (e.g. new
, add
, etc.) to get detailed help for that command:
$ assegai generate --help
To create, build, and run a new basic Assegai project in development mode, navigate to the folder where you want to create the project and run the following commands:
$ assegai new my-assegai-project $ cd my-assegai-project $ assegai serve
To see the new application running, open your web browser and go to http://localhost:5000.
Tip
You can change the default port by editing the port property in the assegai.json
file.
Project structure
When you run assegai new
, the Assegai CLI creates a new folder and generates a starter set of files for a new project. You can then build upon this default structure by adding additional components as needed. This default project structure is referred to as "standard mode." You can find more information about this structure and how to work with it throughout the documentation.
CLI command syntax
All Assegai commands have the same general structure:
$ assegai <command-or-alias> <required-arg> [optional-arg] [options]
For example:
$ assegai new my-assegai-project --dry-run
Command overview
To view command-specific options for any of the following commands, run assegai <command> --help
:
For detailed descriptions of each command, refer to the usage instructions.
Command | Alias | Description |
---|---|---|
new |
n |
Generates a new standard mode application with all the necessary starter files to run the app. |
generate |
g |
Creates or modifies files based on a predefined template. |
serve |
Starts the HTTP development server. | |
add |
Installs a library that has been packaged as an assegai library and runs its installation schematic. | |
info |
i |
Shows information about installed Assegai packages and other useful system information. |