Set Up environment

Copy the .env.example to .env. This provides basic environment variables which your Hireath install may need to know about.

cp .env.example .env

By default, you won’t see any debug output if there’s errors because the default configuration is to run in production (primarily for security reasons). So if you’re just messing around or working in a non-public development environment, update the file and set DEBUG equal to true:

DEBUG    = true
CACHING  = false
LOGGING  = false
TIMEZONE = America/Los_Angeles

Once you actually go to production you’ll want to set DEBUG back to false and, most likely, CACHING set to true.

Ensure Storage is Writable

If you’re just testing things out and are running PHP’s built-in web server as the same user that you installed with, you probably don’t need to worry too much about this. If not, the examples below are just examples and we assume you know enough about how to admin your own servers.

Hiraeth needs a place to write files. Since you’re probably running it through an HTTP or PHP-FPM server, you’ll want to make sure that server can write to storage in the application root. On Linux systems, we strongly suggest the use of ACLs. One common way to do this is to ensure the user your server runs as (www-data is common) has read, write, and execute access by default (and at present).

setfacl -R -dm u:www-data:rwx storage
setfacl -R -m u:www-data:rwx storage

As ACLs use the group permissions to define the maximal permissions for any users or groups in the ACL, you’ll also want to make sure everything starts as group writable.

chmod -R g+w storage

For Linux or Unix-based systems that don’t have this option, you may need to change the group to whatever group your system runs as:

chgrp -R www-data storage
chmod -R g+w storage

In both cases, you will likely also need to tweak your UMASK or server configurations to ensure when new files/folders are being created, they’re created with group writable permissions.

Non-Linux users, you’re on your own.

Using PHP’s Built-In Web Server

Hiraeth provides a passthru call to PHP’s built-in web server that allows you to quickly start a local development server. To start this local server with your application’s public directory as the document root, simply execute (from your application root):

php bin/server

If you didn’t install hiraeth/boostrap you may not have a public/index.php. Alternatively, you can install hiraeth/diactoros or anything which implicitly provides the hiraeth/http implementation. If you’re trying to roll your own custom solution, check out the information about creating a custom entry point.

You can then visit http://localhost:8080/ to hit the public/index.php entry point. Other pages throughout this documentation will use this as a reference URL for examples.

If you want to change the host and port which the server runs on you can modify your .env and add something like:

[SERVER]

	HOST = myhost.local
	PORT = 3000

You may be noticing that the .env file above doesn’t look like a normal dot env file. That’s because all configuration in Hiraeth is done in JIN. We strongly suggest you familiarize yourself with JIN before moving along.


I’m ready to create my first page No, I’m writing an API