Basic framework I am creating for practice. Future intent is to host my own personal site using this framework.
Defined in routes/web.php with the format:
return [
'GET' => [
'<PATH>' => '<Fully Qualified NameSpace of Controller>@<MethodName>',
],
]
Controller classes are placed in app/Controllers. Supported return values include a view or JSON data. A view
path is returned in one of two formats and is relative to the view folder.
// Without Arguments (view only)
return response("view", "<path to view>");
// With Arguments
return response("<'view' or 'json'>", $data);
// Where $data above is...
$data = [
'view' => '<path to view>',
'args' => ['<variableName1>' => '<value1>', ...]
];
// ...or...
$data = <something JSON-able, e.g. an array>;
Any model classes go within app/Models and should extend Framework/BaseModel. At the moment, no full ORM exists - heavy work in progress both in documentation and function.
- Protected property
$dbcontains a PDO connection to the database configured. protected $tableshould be set to the table name.- The
->all()method returns an array of model objects with the aattributesproperty containing the row's data. - The
->select()method accepts a string or an array of columns, and returns an array of model objects.
Views are placed in the views directory.
See config/env.example.php for the database connection parameters. Optional.
Basic Webpack configuration included with asset base located at /assets/index.js. Includes Babel, Sass, and URL loaders.
NPM scripts include npm run build and npm run watch.
getBasePath(<optional appends>)returns the path of the applications root directory.getViewPath(<optional appends>)returns the path of a theviewdirectory.config(<name>)returns associated<name>.phpconfig located in/config.
- Migrations & Database Seeders.
- DB Query Helpers & ORM.
- View Templates or similar.
- Route parameters.
- Error Handling (and develop vs production).
- Shell commands.