|Classes of Slavko Srakocic||>||B12 PHP FW||>||fwphp/glomodul/adrs/README.md||>||Download|
This script is J:\awww\www\fwphp\glomodul\adrs\README.md
adrs module is based on :
![MINI3 - A naked barebone PHP application]
MINI3 is an extremely simple and easy to understand skeleton PHP application, max reduced. MINI3 is NOT a professional framework and it does not come with all the stuff real fws have. If you just want to - show some pages - do CRUD (few database calls) - little-bit of AJAX - without reading in massive documentations of highly complex professional frameworks then MINI3 might be very useful for you. MINI3 is easy to install, runs nearly everywhere, doesn't make things more complicated than necessary.
History of this code (Changelog) shows that modern coding (OOP, namespaces, autoloading class scripts...) is difficult to learn but easy when we learn it : 1. original MINI, made by JaoNoctus 2. MINI (panique original version) 3. MINI2 (panique used Slim router) 4. MINI3 is an excellent and improved version of the original MINI, made by JaoNoctus. Big thanks, man! :) 5. adrs module made by phporacle (Slavko Srakocic, Zagreb) - (I think) simpler and changed some basic features.
MINI3 Features (panique)
Module adrs features (phporacle)
Same as MINI3, plus : - coding style "each module in own folder" like Oracle .fmb-s, not three dirs M, V, C for all modules - OWN MODULE FOLDER (I think much better) and THREE DIRS coding stiles (~ all php frameworks) are VERY DIFFERENT (code flow...). - smaller number of folders and scripts, we do not need them because of each module in own folder. - no need for mod_rewrite, thanks to QS='?' - no constants but pp1 object array (better than Oracle forms Property palette) and uriq object array (URL query elements) - class hierarchy (inheritance) allows use of $this (which is $db) everywhere. - routing changed : pretty URL-s are key-value pairs, so no need for "controller/action/param1/param2..." url style, ee order of url pairs is as we wish. - routing should work also with Composer autoload clases (set QS='' instead '?'). I tested Composer autoload clases for older adrs version (pretty URL-s were not key-value pairs). - I tested also routing table solution and I think it is much more complicated. - dispatching is simmilar to MINI3, can be separate class - method, but for each module in own folder like Oracle .fmb-s one class (Home_ctr) is enough. So dispatching is to Home_ctr methods. Home_ctr methods include (view) scripts. Views may be also classes, but I do not see need for this.
Installation (in Vagrant, 100% automatic) on Ubuntu 14.04 LTS
Auto-Installation on Ubuntu 14.04 LTS (in 30 seconds)
Manual Installation on Ubuntu 14.04 LTS and Windows 10
Feel free to commit your guideline for Ubuntu 16.04 LTS or other linuxes to the list!
MINI3 runs without any further configuration. You can also put it inside a sub-folder, it will work without any further configuration. Maybe useful: A simple tutorial on How to install LAMPP (Linux, Apache, MySQL, PHP, PHPMyAdmin) on Ubuntu 14.04 LTS and the same for Ubuntu 12.04 LTS.
Server configs for
A deeper discussion on nginx setups can be found here.
The script makes use of mod_rewrite and blocks all access to everything outside the /public folder. Your .git folder/files, operating system temp files, the application-folder and everything else is not accessible (when set up correctly). For database requests PDO is used, so no need to think about SQL injection (unless you are using extremely outdated MySQL versions).
How to include CLASS SCRIPTS / use PSR-4 - not in adrs
As this project uses proper PSR-4 namespaces, make sure you load/use your CLASS SCRIPTS correctly:
Instead of including classes with old-school code like
But wait, there's no
This might look stupid at first, but comes in handy later. To sum it up:
To load the file
FYI: As decribed in the install tutorial, you'll need do perform a "composer install" when setting up your application for the first time, which will create a set of files (= the autoloader) inside /vendor folder. This is the normal way Composer handle this stuff. If you delete your vendor folder the autoloading will not work anymore. If you change something in the composer.json, always make sure to run composer install or composer update again!
MINI3 comes with a little customized PDO debugger tool (find the code in application/libs/helper.php), trying to emulate your PDO-SQL statements. It's extremely easy to use:
This project is licensed under the MIT License. This means YOU CAN USE AND MODIFY IT FOR FREE IN PRIVATE OR COMMERCIAL PROJECTS.
The structure of MINI3 in general
The application's URL-path translates directly to the controllers (=files) and their methods inside application/controllers.
Self-explaining, right ?
MINI3 showing a view
Let's look at the exampleOne()-method in the home-controller (application/Controller/Home_C.php): This simply shows the header, footer and the example_one.php page (in views/home/). By intention as simple and native as possible.
MINI3 Working with data
Let's look into the index()-method in the songs-controller (application/Controller/Song_C.php): Similar to exampleOne, but here we also request data. Again, everything is extremely reduced and simple: $Song->rall() simply calls the rall()-method in application/Model/Song.php (when $Song = new Song_M()).
For extreme simplicity, data-handling methods are in application/model/ClassName.php. Have a look how rall() in z_Model.php looks like: Pure and super-simple PDO.
The result, here $songs, can then easily be used directly inside the view files (in this case application/views/songs/index.php, in a simplified example):
Please commit into the develop branch (which holds the in-development version), not into master branch (which holds the tested and stable version).
October 2019 [phporacle] see Module adrs features (phporacle)
December 2014 - [panique] css fixes - [panique] renamed controller / view to singular - [panique] added charset to PDO creation (increased security)
November 2014 - [panique] auto-install script for Vagrant - [panique] basic documentation - [panique] PDO-debugger is now a static helper-method, not a global function anymore - [panique] folder renaming - [reg4in] JS AJAX calls runs now properly even when using script in sub-folder - [panique] removed all "models", using one model file now - [panique] full project renaming, re-branding
October 2014 - [tarcnux/panique] PDO debugging - [panique] demo ajax call - [panique] better output escaping - [panique] renamed /libs to /core - [tarcnux] basic CRUD (create/read/update/delete) examples have now an U (update) - [panique] URL is now config-free, application detects URL and sub-folder - [elysdir] htaccess has some good explanation-comments now - [bst27] fallback for non-existing controller / method - [panique] fallback will show error-page now - [digitaltoast] URL split fix to make php-mvc work flawlessly on nginx - [AD7six] security improvement: moved index.php to /public, route ALL request to /public
September 2014 - [panique] added link to support forum - [panique] added link to Facebook page
August 2014 - [panique] several changes in the README, donate-button changes
June 2014 - [digitaltoast] removed X-UA-Compatible meta tag from header (as it's not needed anymore these days) - [digitaltoast] removed protocol in j Query URL (modern way to load external files, making it independent to protocol change) - [digitaltoast] downgraded j Query from 2.1 to 1.11 to avoid problems when working with IE7/8 (j Query 2 dropped IE7/8 support) - [panique] moved jQuery loading to footer (to avoid page render blocking)
April 2014 - [panique] updated j Query link to 2.1 - [panique] more than 3 parameters (arguments to be concrete) are possible - [panique] cleaner way of parameter handling - [panique] smaller cleanings and improvements - [panique] Apache 2.4 install information
January 2014 - [panique] fixed .htaccess issue when there's a controller named "index" and a base index.php (which collide)
And by the way, I'm also blogging at Dev Metal :)
Support the project
Rent your next server at 1&1 to support this open source project.