Table of Contents
Opulence's directory structure was inspired by the best of ideas from frameworks like Laravel and Aura. The directories logically separate files based on their purpose. However, you are not chained to this structure. If you do decide to customize it, make sure you update the PSR-4 settings in composer.json as well as the relevant paths in config/paths.php.
This contains the code that actually boots up your application. It's probably best not to touch the contents unless you are sure you know what you are doing.
All configuration files for your application should go here. Console-specific configs are in the console subdirectory, and web-specific configs are in the http subdirectory. The environment subdirectory holds .env.*.php files to setup your server with environment variables.
- English translation files are here
- Raw assets (eg SCSS files) are here
- View template files are here
- HTML error template files are here
- JSON error template files are here
This is where your project's core code goes. If it's a PHP class, it belongs in here. Opulence subscribes to the domain-driven design philosophy, which encourages you to separate your domain models from your application logic. The subdirectories under src are:
The application layer stores code that is used to interface your domain logic with your presentation layer. It also contains classes that bootstrap your application. It contains the following subdirectories:
- Console bootstrappers are here
- HTTP bootstrappers are here
- Console commands are here
- Events are here
- Event listeners are here
- HTTP controllers are here
- HTTP middleware are here
- View builders are here
Your core business logic and models belong here. This is the heart of your application. This code is written to an interface. It's recommended that you add subdirectories for each domain type, eg Blog for all business logic and models dealing with blog posts.
Your concrete implementations of your interfaces go here. This directory should house any code that interacts with storage, eg databases and cache.
Put your unit tests in this directory.
Any files that are generated by your application, such as compiled views, are stored here. This is different than the resources directory in that files here are meant to be read and written to by the application, not a developer. The subdirectories are:
- This is meant for any configuration done by Opulence and is not meant to be used by your application
- This is where your log files go