Project Structure

The recommended structure of an ArrowPHP project

Overview

After running vendor/bin/arrow-build your project should look like the below structure.

  • /cache

    • /config.php

  • /config

    • /config.middleware.php

    • /config.php

  • /http

    • /index.php

  • /logs

  • /src

  • /vendor

  • /http-server.php

Details

/cache

This is the directory where all cached data is stored.

/cache/config.php

This file contains the result of all config files merged together. The purpose of caching this file is to prevent the framework from traversing the files system looking for the installed packages and their configs on every request.

/config

This is the directory where all application specific config files are stored. You can read more about config files in the Config section.

/config/config.php

This is the core application config file. Any config value update which overrides a framework or package config should go here.

/config/config.middleware.php

To simplify the specification of config values, they can be split up into any file matching the pattern "config.<word>.php", where <word> is used as the config value key.

As an example of this, and as setup by default, this file simply specifies the modules which should be loaded by the application. These files will overwrite the corresponding setting (if set) in the config.php file.

/http

This directory contains all the publicly accsesible files; this director is considered your web-root.

/http/index.php

This is the default index.php file which would be accessed when navigating to the root address of your URL.

/logs

This is the directory where the application will write it's log file(s).

/src

This is the directory where all your source files will go. If you copied the example composer.js file from the Installation page, you will notice that the autoload functionality is already setup for your PHP files within the src directory, provided you put them in the App namespace.

/vendor

This is the directory where all the libraries required in the composer.js file are stored.

You should never change any of the files in the vendor directory manually.

/http-server.php

This file is created for you by the build tool, however it is not required. This file can be used to run your web application or microservice though PHPs built-in server instead of having to setup a web-server. This is a great way to get up and running quickly for development, but it is not advised that you use this in a production environment.

To use this file, run the following command from the root directory of your project.

$ php -S 0.0.0.0:80 http-server.php -t http/

This command will run the server so any IP can connect, on the standard web port, routing all requests through http-server.php, using the http directory as the web root.

Last updated

Was this helpful?