Skip to content

Initializing Your Project

Ryan Jentzsch edited this page May 8, 2019 · 7 revisions

Initializing Your Project

If you followed the first part of the guide you were able to send a request via a web browser and got a JSON response. This is just a sample 'hello world' that ships with Willow.

🏁 Database Initialization

Let's initialize your project. In a terminal window at the root of your project run this:

Linux/Mac ./willow willow:init

Windows (untested) willow willow:init

When you run this command you will be prompted for the database credentials to a running MySQL/MariaDB database. These credentials are saved in a secret .env file that Willow uses any time it needs to connect to your database.

You don't need to use this command to create this file. Using a text editor you can create a .env file. There is an env-example file in the root of your project you can use as a template if you want to manually create the .env file.

🤖 Testing the database connection

Type this command: willow db:show-tables

If your credentials are correct in the .env file then you should see a list of tables in your database. If you get an error then manually edit your .env file and make sure the credentials and location of your server are correct.

Next up is Establishing Models, Controllers, and Actions

📦 Deployment

Once you have your project working in development here are the recommendations for deploying to production.

  • Place your project in a managed repository such as Github.
  • In the production enviroment pull the repo.
  • Make a copy of the .env file or use the included env-example file filling in the values for your production environment.
  • Follow the guides for Slim for your chosen web server.
  • If you configure your web server to handle CORS then you may want to remove CORS handling from app/Main/app.php