You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm mostly doing this as an exercize in picking through some decisions other frameworks have made.
@@ -11,17 +11,18 @@ I think that everyone has their own idea of simple, this is designed for a proje
11
11
* Di/Configuration autocompletes in PhpStorm 10+
12
12
* PSR 2 compliant
13
13
* Di/Configuration both work the same way, and can be configured per environment.
14
-
* By default does not include any external libraries, I'll try to add examples for how to use twig for views.
14
+
* Possibly no external libraries for the framework itself though I will be giving installation instructions with composer.
15
+
* phpunit will be used in examples to run tests.
15
16
* Easy to debug from end to end. I want to hit very little code before hitting the custom logic in the controller.
16
-
*Examples of how to use a persistance (database) and view, but nothing is included by default.
17
-
*A handful of common simple objects that you can optionally use (Session, Request, Response)
17
+
*A handful of common simple objects that you can optionally use (Session, Log, Request, Response)
18
+
*To implement the example project I am building I will look into using the controller with REST verbs, though I'm currently unsure of how I plan to implement it.
18
19
19
20
## Example flow when using this framework
20
-
An http POST happens: http://yoursite/account/save
21
+
An http POST happens: http://yoursite/Account/save
21
22
22
-
Apache rewrite sends everything to http://yoursite/index.php behind the scenes with a path of /account/save
23
+
Apache rewrite sends everything to http://yoursite/index.php behind the scenes with a path of /Account/save
23
24
24
-
index.php calls the routing code that loads the controller account and calls the method saveAction.
25
+
index.php calls the routing code that loads the controller Account and calls the method saveAction.
25
26
26
27
The controller then makes sure the person is logged in and is who they say they are.
27
28
@@ -33,9 +34,15 @@ The controller then uses the AccountManager to save the object.
33
34
34
35
The controller then returns a json encoded response indicating everything went well.
35
36
36
-
## Installation
37
+
## Changes to above flow when using REST
38
+
An http PUT happens to : http://yoursite/Account/12345
37
39
38
-
## Write Something Small
40
+
The router sees that rest is enabled on the account controller and calls the account/put method.
39
41
40
-
## Unit Testing
42
+
The put method then ensures that the person is logged in, validates the data, gets the repository and updates the object in the repository, and returns an affermative response.
43
+
44
+
## Installation With Composer
45
+
Since composer is an easy way to pull in additional libraries you will need for your project I'm going to just explain how to install this project with composer.
41
46
47
+
## Unit Testing
48
+
In general you just put tests in the testing directory with the same structure as the classes you are testing in the classes directory. The environment is Testing and so the associated configuration and dependency injection classes will be loaded.
0 commit comments