Somewhere about 8 years ago, I needed to decide on a PHP framework for the implementation of one project. Of the frameworks, I knew only by hearsay zend, and ModX Revo with Bitrix. The latter could hardly be called a framework - they were full-fledged CMS, of which there were a huge variety at that time, and they were at the peak of their popularity. At that time, they were not looking for Laravel or Symfony developers, then administrators / moderators / developers of Bitrix, Drupal, etc. were needed.
And then I decided to write my framework with "0". The task was simple - I needed to work with a database and a RESTful API interface.
So - we begin to collect two-wheeled.
"Lazy and a holiday on weekdays"
DB
It began that I was a little lazy and I didn't want to write SQL queries directly to the database at all, especially since I "swallowed" it in previous projects.
This led me to search for something ready-made, and I stumbled upon the then young Medoo.in framework , and this turned out to be discovery # 1 . Having slightly "modified" the framework, the problem with the database was solved.
Getting started with the RESTful API interface
What it is? - These are just GET, POST, PUT, DELETE requests from client to server. No matter how hard they try to put a huge meaning into this word "REST".
What about SOAP ?!
SOAP - REST XML GET POST. :)
REST' , . - , - - , .
MODX friendly() , (.htaccess) Apache. , :
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
, :
, index.php , , 4 , .
http://.///-/ http://./index.php?q=//-/
! , .
!!!
, "", , , phpdocs.
- , - , 2- - public . - . Init .
GET, POST, .. $SERVER["METHOD"], .
http://domen.com/users/list/10/30 users.controller.php public function list($params) {}
-, .
, . MVC - // - , View.
2- MVC
MVC - - "".
- "" . , , " ", "".
- , . , View, () . html, , , . .
- . ? . , , - .
- . HTML, JSON, XML, ! .
5 , , 250 . REST , php, , 15% - !
, ...
...
" "
, ...
, , , "" VIEW .
TWIG - ! TWIG , , , - 100 "", "", ., .
, (object), , SOLID ( ) !
! -, !
...
...
, - !!!
" - "
. CODECEPTION.
Composer - - ! (vendors) .
- SILENIUM CODECEPTION - , .
And the link from Codeception
Now I ’ve definitely gone to drink my "Cuba Libre"!
Next time I will tell and compare the same task on 4 popular frameworks - these are Laravel, Symfony, Yii2 and Phalcon, I will try to talk about their "+" and "-" with a simple example, what problems I encountered myself and how I solved them ...
Thank you, cheer up!