init

This is the official documentation of the forestadmin/laravel-forestadmin v2+ and forestadmin/symfony-forestadmin PHP agents.

The forest init command provides an all-in-one initialization command that will:

  • allow you to log in if you haven't already done so with forest login

  • set up your Development Environment on a given project.

$ forest init --help
Set up your development environment in your current folder.

USAGE
  $ forest init

OPTIONS
  -p, --projectId=projectId  The id of the project you want to init.

forest init is not meant to help you create a new project. If you don't have an existing project yet, please refer to this guide.

forest init should be run from your project's codebase root directory.

Login

All Forest Admin CLI commands require to be authenticated. You can do this on the fly using forest init or use forest login first. Refer to the forest login page if you need further details.

Project selection

The Development Environment you will initialize is unique per project and per developer. It is thus mandatory that we identify the right project to create your environment accordingly:

If you only have 1 project attached to your Forest Admin account, this step will be automatically skipped.

If you have more than 1 project, you'll be asked to choose one. It must match the project from your current directory.

Endpoint selection

If you're using forest init, it means your Agent should already be running locally. If you used the default values used during installation, your endpoint should be http://localhost:3310.

Since Forest Admin needs to know your project's local endpoint to create your Development Environment, we've left the same default values. You can just hit "Enter" to use those; otherwise, simply fill in the host and port to fit your configuration.

[? Enter your local agent host: (localhost) localhost
[? Enter your local agent port: (3310)

At this point, your Development Environment will be created! 🎉

Note that your new Development Environment is identified by the FOREST_ENV_SECRET in your .env file. If you do not have such file, it will be generated automatically during the command execution.

(Optional) Connecting your database

To work properly in your local environment, your Forest Admin Project needs to be connected to the corresponding database (which could be local or remote, it's your choice).

As a result, we've added an extra step to the forest init command to help you set up your database. If you accept the help, you'll be taken through a few prompts and your DATABASE_URL will be generated and added to your .env file.

Last updated