<h2>
# ******** I DO NOT LIKE THREE M,V,C DIRS FOR ALL MODULES (I LIKE EACH MODULE IN OWN DIR) !!
# ******** I DO NOT LIKE TEMPLATES !!
</h2>
<pre>
http://dev1:8083/fwphp/glomodul4/help_sw/test/01_MVC_learn/01inanz/home
http://www.inanzzz.com/index.php/post/07gt/creating-a-simple-php-mvc-or-framework-application-from-scratch
# example uses composer.json and PSR-4 namespace structure. It will help us
# prevent using many 'require' and 'include' statements in our files
#How it works
#################
The first segment of URL is "controller" name
and the second one is "method" name in that controller.
# Logic
1. User goes to: http://www.yourdomain/
2. Request gets picked up by index.php
3. Relevant controller and its method gets triggered
4. Response is send back
# Example 1
1. Request: http://www.yourdomain/league
2. Process: index.php hits "indexMethod" method of League.php controller
3. Content: Template.php reads "Home\index.html" under "View"
4. Response send back
# Example 2
1. Request: http://www.yourdomain/user/full-detail
2. Process: index.php hits "fullDetailMethod" method of User.php controller
3. Content: Template.php reads "User\fullDetail.html" under "View"
4. Response send back
# Example (Error)
1. Request: http://www.yourdomain/league/non-existing
2. Error gets triggered as:
404
Method cannot be found: [Controller\league:nonExistingMethod]
/var/www/html/mvc/src/Core/Request.php:88
# Install composer on system
$ curl -sSk https://getcomposer.org/installer | php -- --disable-tls
All settings correct for using Composer
Downloading 1.2.1...
Composer successfully installed to: /vagrant/composer.phar
Use it: php composer.phar
You have instructed the Installer not to enforce SSL/TLS security on remote HTTPS requests.
This will leave all downloads during installation vulnerable to Man-In-The-Middle (MITM) attacks
# Globally enable composer
$ mv composer.phar /usr/local/bin/composer
$ composer self-update
You are already using composer version 1.2.1 (stable channel).
# Generate composer autoloader for the application
mvc $ composer dump-autoload -o
Generating optimized autoload files
# ******** I DO NOT LIKE THREE M,V,C DIRS FOR ALL MODULES !! :
-01inanz or mvc or ... # Name of the application (can be anything)
~~ mvc_tests_inanz ~~~~~~~.nppses
index.php # System file
.htaccess # System file
composer.json # System file
-app # System directory
config.php # System file
-asset # Where you keep assets (you can restructure it)
-css # Example directory
site.css # Example file
-image # Example directory
image.jpg # Example file
-js # Example directory
site.js # Example file
-src # System directory
-Controller # System directory
AbstractController.php # System file
Home.php # Example file
League.php # Example file
SEE VENDOR -inanz instead -Core # System directory
-Helper # Where you put helper classes
-Model # Where you put model classes
-Repository # Where you put repository classes
-View # System directory
-Home # Example directory
index.html # Example file
-League # Example directory
index.html # Example file
base.html # System file
-vendor # System directory generated by composer.json
-composer # System directory generated by composer.json
autoload.php # System file generated by composer.json
-inanz # System directory -- own Core scripts
autoload.php # System file instead composer autoload.php
Request.php # System file
Template.php # System file
</pre>
|