Skip to content

Directory Structure

Zane Hooper edited this page Feb 21, 2017 · 1 revision

You are free to layout the directory structure of your package however you please, but we recommend sticking to our design patterns. Please see Report Namespace from the Abuse Package for an example directory structure. This format allows for easy unit testing and modularized features. Each feature should have its own namespace. You are free to nest one feature inside of another if the nested feature relies on the parent one.

You can generate a skeleton just like this one using the Developer Package.

Below is a table of what files handle what:

File Responsibility
Report The Report Eloquent Model
ReportController Routes requests into the respective Services
ReportEventProvider Adds Event Listeners to the application
ReportFilterService Filters a list query based on the request (authorization, manual filtering)
ReportListRequest Validates a list request and can order the list query
ReportPatchRequest Validates a request to update a specific Report
ReportRepository List of Reports
ReportRoutesProvider Defining Routes for the API
ReportServiceProvider Define any Providers the feature needs
ReportTransformer Turn a Report into an array to be output by the API
ReportUpdateService Updates or creates a specific Report