|
1 |
| -# SlimPHP 4 Skeleton MVC App |
| 1 | +# Source files for https://rotexsoft.github.io/slim-skeleton-mvc-app/ |
2 | 2 |
|
3 |
| -[](https://github.com/rotexsoft/slim-skeleton-mvc-app/actions/workflows/php.yml) |
4 |
| - |
5 |
| - |
6 |
| -[](https://coveralls.io/github/rotexsoft/slim-skeleton-mvc-app?branch=master) |
7 |
| - |
8 |
| - |
9 |
| - |
10 |
| - |
11 |
| - |
12 |
| - |
13 |
| - |
14 |
| -<a href="https://libraries.io/github/rotexsoft/slim-skeleton-mvc-app"> |
15 |
| - <img alt="Libraries.io dependency status for GitHub repo" src="https://img.shields.io/librariesio/github/rotexsoft/slim-skeleton-mvc-app"> |
16 |
| -</a> |
17 |
| - |
18 |
| - |
19 |
| -> The documentation for the version of this framework based on SlimPHP 3 can be found [here](https://github.com/rotexsoft/slim-skeleton-mvc-app/tree/slim-3-edition). |
20 |
| -
|
21 |
| - |
22 |
| -This is a template web-application (powered by [SlimPHP 4](https://www.slimframework.com/)), that can be extended to build more complex web applications. |
23 |
| - |
24 |
| -While it is not necessary to have expert understanding of the SlimPHP 4 framework (https://www.slimframework.com/docs/v4/) in order |
25 |
| -to build web-applications with this template application framework, such understanding would help in maximizing the capabilities |
26 |
| -of this template application framework. |
27 |
| - |
28 |
| -## Features / Benefits of using the Slim MVC Framework |
29 |
| -* It adds the Model-View-Controller structure to your web-application. Actually, really more of Controller-View functionality with a **model** folder provided for housing your Model classes (leaving you with the responsibility of choosing whichever ORM / Database Access Library suits your needs or are most comfortable with) |
30 |
| - |
31 |
| -* Provides a skeleton folder / directory structure for your application: |
32 |
| -``` |
33 |
| -./path/to/newly/created/app |
34 |
| -|-- config/ |
35 |
| - |-- languages/ |
36 |
| -| |-- en_US.php |
37 |
| -| `-- fr_CA.php |
38 |
| -| |-- app-settings.php |
39 |
| -| |-- app-settings-dist.php |
40 |
| -| |-- dependencies.php |
41 |
| -| |-- env.php |
42 |
| -| |-- env-dist.php |
43 |
| -| |-- ini-settings.php |
44 |
| -| `-- routes-and-middlewares.php |
45 |
| -| |
46 |
| -|-- logs/ |
47 |
| -| |
48 |
| -|-- public/ |
49 |
| -| |-- css/ |
50 |
| -| |-- images/ |
51 |
| -| |-- js/ |
52 |
| -| `-- index.php |
53 |
| -| |
54 |
| -|-- src/ |
55 |
| -| |-- controllers/ |
56 |
| -| |-- layout-templates/ |
57 |
| -| |-- models/ |
58 |
| -| |-- views/ |
59 |
| -| `-- AppErrorHandler.php |
60 |
| -| |
61 |
| -|-- tests/ |
62 |
| -| |
63 |
| -|-- tmp/ |
64 |
| -| |
65 |
| -|-- vendor/ |
66 |
| -| |
67 |
| -|-- .gitignore |
68 |
| -|-- composer.json |
69 |
| -|-- composer.lock |
70 |
| -`-- README.md |
71 |
| -``` |
72 |
| - |
73 |
| -* Provides some helper functions like **sMVC_UriToString(\Psr\Http\Message\UriInterface $uri)**, |
74 |
| -**sMVC_addQueryStrParamToUri(\Psr\Http\Message\UriInterface $uri, $param_name, $param_value)**, etc. in the default global namespace and a few string helper functions in the **`SlimMvcTools\Functions\Str`** namespace |
75 |
| - |
76 |
| -* Provides an automatic routing scheme for mapping request urls to methods in Controller classes that are sub-classes of **`SlimMvcTools\Controllers\BaseController`**. You don't need to define any routes for your application if you adhere to using Controllers that are compatible with the routing scheme |
77 |
| - * Also supports operating using only pure Slim PHP functionality (i.e. you can manually / explicitly define all or some of the routes (each of which may or may not make use of Controller classes as route handlers) and middle-wares for your application. You can also disable the automatic routing scheme described above if you plan to manually define all your routes. Manually / explicitly defined routes will override automatic routes with the same path definition) |
78 |
| - |
79 |
| -* Ships whith a BaseController class (i.e. **`SlimMvcTools\Controllers\BaseController`**) that provides methods for authentication (login, logout & checking authentication status), listing all methods in all controller classes in an application that can be automatically routed to if the automatic MVC routing is enabled, forcing HTTP 400, 401, 403, 404, 405, 410, 500 & 501 responses and methods for rendering **php** view and layout files using the light-weight and easily extensible [Rotexsoft\FileRenderer\Renderer](https://github.com/rotexsoft/file-renderer) class. Take a look at the class for a full list of methods that can be used in your applications. |
80 |
| - |
81 |
| -* Provides a command-line script for creating Controller classes (that extend **`SlimMvcTools\Controllers\BaseController`** or any of its descendants). |
82 |
| - * **`./vendor/bin/smvc-create-controller`** on **`*nix-like`** Oses and **`.\vendor\bin\smvc-create-controller.bat`** on **`Windows`** |
83 |
| - * NOTE: **`./vendor/bin/smvc-create-controller-wizard`** is the interactive version of **`./vendor/bin/smvc-create-controller`** |
84 |
| - |
85 |
| -* Ships with a very minimal amount of composer / packagist dependencies (all of which are used by **`SlimMvcTools\Controllers\BaseController`**) in order to allow you to include only additional dependencies that suit the specific needs of your application. Thereby reducing the possibility of having unused / unneeded dependencies in your application. The following packages are used in this framework: |
86 |
| - * [Slim Framework Version 4](https://github.com/slimphp/Slim/tree/4.x): for routing http requests to action methods in Controller classes (or other callables acceptable by Slim for responding to requests that match defined routes) and sending back http responses to clients |
87 |
| - * [File Renderer](https://github.com/rotexsoft/file-renderer): for rendering php layout and view files (which basically contain a mix of php, html, css & Javascript) which will be sent back as html in http response bodies to clients. Plain Text, Json, Xml & other non-html responses can be emitted directly from Controller Action methods (they don't need this renderer) |
88 |
| - * [Vespula Auth](https://packagist.org/packages/vespula/auth): a lightweight authentication package that is used by the default login & logout actions in the BaseController to authenticate users. An in-memory sqlite db is used for authentication by default, you should switch to a proper relational db like Mysql (which this package can also autheticate against) |
89 |
| - * [Vespula Locale](https://packagist.org/packages/vespula/locale): another light-weight package for managing localized strings in this framework. Things like error messages during login are managed using an instance of this package to display those messages in the desired language selected by the user. US English & Canadian French are the two languages this framework supports out of the box. Other locale files can be added to the **./config/languages** folder and their locale code(s) should be added to the container (**$container[ContainerKeys::VALID_LOCALES]**) and a link for that language should be added to the layout template with the appropriate query string so that users that click on it can set that language as their desired language when interacting with an application built with this framework |
90 |
| - * [Vespula Log](https://packagist.org/packages/vespula/log): a PSR-3 Logger that is used throughout this framework for logging various events (like successful login & logout events, etc.). It's lighter than other packages like Monolog and pretty decent. |
91 |
| - * [Pimple](https://packagist.org/packages/pimple/pimple): a simple Dependency Injection Container that is used to power [\SlimMvcTools\Container](https://github.com/rotexsoft/slim-skeleton-mvc-tools/blob/master/src/Container.php) (the [PSR-11](https://packagist.org/packages/psr/container) compliant container that ships with this framework) |
92 |
| - * [Nyholm PSR7](https://packagist.org/packages/nyholm/psr7): A fast PHP7 implementation of PSR-7 injected into SlimPHP by this framework |
93 |
| - * [Nyholm PSR7 Server](https://packagist.org/packages/nyholm/psr7-server): Helper classes to handle PSR-7 server requests, also used by SlimPHP within this framework |
94 |
| - |
95 |
| - > You should also look at the public methods available in [\SlimMvcTools\Controllers\BaseController](https://github.com/rotexsoft/slim-skeleton-mvc-tools/blob/master/src/controllers/BaseController.php) which all your applications' controller classes will be extending & which will come in handy in your applications like the **forceHttp###**, **getResponseObjForLoginRedirectionIfNotLoggedIn**, **isLoggedIn**, **makeLink**, **renderLayout** & **renderView** methods |
96 |
| -
|
97 |
| - |
98 |
| -* Strives to adhere strictly to the **PSR-7 HTTP messages** and **psr/container** interfaces, in order to make it easy to use different implementations of the PSR-7 request and response objects and **psr/container** compliant containers |
99 |
| - |
100 |
| -## Requirements |
101 |
| - |
102 |
| -* PHP 7.2+ (for version 3.X) or PHP 7.4+ (for version 4.X) or PHP 8.1+ (for version 5.x) |
103 |
| -* Pdo sqlite (3) extension for Authentication in non-production environments |
104 |
| -* Composer (https://getcomposer.org) |
105 |
| - |
106 |
| -## Documentation |
107 |
| - |
108 |
| -* [Quick Start Guide](documentation/QUICKSTART.md) |
109 |
| -* [MVC Functionality](documentation/MVCFUNCTIONALITY.md) |
110 |
| -* [Real World Usage: Creating a Movie Catalog application](documentation/MOVIE_CATALOG_APP_WALK_THROUGH.md) |
111 |
| -* All command-line examples assume you have changed directory to the root folder of your newly created application. |
112 |
| -* Please submit an issue or a pull request if you find any issues with the documentation. |
113 |
| - |
114 |
| -## Branching |
115 |
| - |
116 |
| -These are the branches in this repository: |
117 |
| - |
118 |
| -- **master:** contains code for the latest major version of this framework |
119 |
| - > There should always be a slim-#-edition-versions-x.x branch that will be synced with master and from which the latest major versions will be tagged. The composer.json in this branch will require the most recent stable version of **rotexsoft/slim-skeleton-mvc-tools** as opposed to the **dev-master** version that will always be required in the composer.json in the master branch. |
120 |
| -- **slim-4-edition-versions-5.x:** contains code for the **5.x** version of this package (currently being synced with master until a newer version 6.x starts being developed on master) |
121 |
| -- **slim-4-edition-versions-4.x:** contains code for the **4.x** version of this package. No new features, only bug fixes accepted. |
122 |
| -- **slim-3-edition:** contains code for the **3.x** version of this package. No new features, only bug fixes accepted. |
123 |
| -- **1.X:** contains code for the **1.x** version of this package. Abandoned. |
124 |
| - |
125 |
| -## Issues |
126 |
| - |
127 |
| -* Please submit an issue or a pull request if you find any problems with this skeleton app. |
128 |
| -* If you are suggesting an enhancement please create an issue first so that it can be deliberated upon, before going on to submit a pull request. |
| 3 | +This branch contains the code behind https://rotexsoft.github.io/slim-skeleton-mvc-app/ |
0 commit comments