Skip to content

soutoner/php-api-structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-api-structure

General structure for a RESTful PHP API project.

<project_name>/
  app/
    Controllers/
    Db/
      Migrations/
      Seeds/
    Exceptions/
    Helpers/
    Http/
    Lib/
    Models/
  bootstrap/
  config/
    environments/
  docs/
  log/
  public/
  scripts/
  tests/

  • app/: It organizes your application components. It's got subdirectories controller (controllers), and the backend business logic (models). It will house the MVC system except for the views.
    • Controllers/: Controllers of your app.
    • Db: Everything related with the database.
      • Migrations/: It will contain iterations of the schema of your database.
      • Seeds/: Seeders that will populate your database with both fake and test data.
    • Exceptions/: Exceptions that your API takes into consideration.
    • Helpers/: It contains any helpers class to assist models, controllers and the rest of the project.
    • Http/: All the classes related with HTTP interaction.
    • Lib/: Libraries of your app except for those located in vendor/.
    • Models/: ORM classes that will access your database.
  • bootstrap/: Start and config you application.
  • config/: The application-wide configuration directory.
    • environments/: Configurations that differ between environments.
  • docs/: This directory contains documentation, either generated or directly authored.
  • log/: Log info generated by your application or your server.
  • public/: Entry point of your web service. Divides the 'user-visible' part of the application from the rest.
  • scripts/: Maintenance and/or build scripts that are not executed at runtime but are part of the correct functioning of the application.
  • tests/: Tests directory. It will contain as many folders as type of tests (functional, unit, acceptance, etc).

Based on Ruby on Rails examples, Zend recommended project structure and Laravel 5 project structure.

About

General structure for a RESTful PHP API project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors