dev-master
9999999-devPHP Utility Classes
Apache-2.0
The Requires
by andy hill
dev-feature/simple-error-handling
dev-feature/simple-error-handlingPHP Utility Classes
Apache-2.0
The Requires
by andy hill
PHP Utility Classes
This was a project to ease the building of websites. It had some good ideas, but was not extensible enough and lost even more relevance when the client side moved beyond jQuery., (*1)
The idea of this project is to be the the poor man's Laravel. By that I mean, I am a huge fan of Laravel, but, (*2)
Do not use this framework to write the next Big Thing. It's meant for little websites of small organizations or hobbies., (*3)
The framework is meant to be small, intelligible, and extensible. It is easy to extend or replace the utilities, assuming the replacements fulfill the contract of the existing utility., (*4)
Also, heavily influenced by the concept of convention over configuration., (*5)
A page might look like this:, (*6)
<?php require('./setup.inc.php'); $local = [ ///// override defaults ]; $page = new \Athill\Utils\Page($local); //// page content $page->end();
What's happening here?, (*7)
$h is an HTML generator. For example:, (*8)
$h->div('content', ['class'=>'rad']); //// div tag //// and $h->odiv(['class'=>'rad']); //// open div tag $h->tnl('content'); //// tab-newline $h->cdiv(); //// close div tag //// both generate <div class="rad">content</div>
There are more complicated, but useful, methods, but you are under no obligation to use $h. Simply end your PHP tag after instantiating $page, reinstate it before calling $page->end(), and place your HTML content in between., (*9)
<?php require('./setup.inc.php'); $local = [ ///// override defaults ]; $page = new \Athill\Utils\Page($local); ?> <!-- page content --> <?php $page->end(); ?>
Work in progress at this point., (*10)
Basic setup and template system in place. Example implementation at demo.anyhill.us. Code at PHP-Utils-Demo. To try it out, you either need a vagrant box or the requirements in the previous update. Running the limited demo page of this repository requires only PHP and Composer, (*11)
> git clone https://github.com/athill/PHP-Utils > cd PHP-Utils > composer update > php -S localhost:8000 //// go to localhost:8000 in your web browser
I've just touched the surface, but am rendering a basic, compliant HTML page. To run the demo:, (*12)
The actual point of this is in the demo/vendor/athill/php-utils/src directory. Much of it in not being used at this point. Currently, here's what happens:, (*13)
As you haven't requested a specific page, you get index.php, which looks like this, (*14)
<?php require_once('setup.inc.php');, (*15)
$page = new \Athill\Utils\Page();, (*16)
$h->p('content');, (*17)
$page->end();, (*18)
PHP Utility Classes
Apache-2.0
PHP Utility Classes
Apache-2.0