drpheltright / lily
A lightweight web application library for PHP.
Requires
- php: >=5.3.3
- filp/whoops: ~1.0.10
Requires (Dev)
- phpunit/php-code-coverage: ~2.0.0
- phpunit/phpunit: ~4.0.2
- satooshi/php-coveralls: ~0.6.1
- symfony/css-selector: ~2.4.1
- symfony/dom-crawler: ~2.4.1
README
A lightweight web application library for PHP 5.3+.
Lily provides your application with a common sense interface to HTTP. She also provides routing, exception handling, dependency injection and more. This project is inspired by the design of ring, especially in regards to the use of higher order functions and middleware.
Lil' Lily has very little to her weighing in at 1019LOC. She aims to be readable in one sitting.
<?php require __DIR__.'/vendor/autoload.php'; // Lily provides building blocks for applications like routing $handler = new Lily\Application\RoutedApplication([ // Define your routes as plain arrays 'routes' => [['GET', '/', 'Hello world']], ]); // Serve your application over HTTP (new Lily\Adapter\HTTP)->run(compact('handler')); ?>
This example uses PHP 5.4 as do all examples found in the wiki. Lily supports 5.3+ though so you can backport examples.
A slightly more complex example can be found in /example
.
Why Lily?
Because she's different. She doesn't enforce you to obide by interfaces and implement classes in a rigid fashion that is tightly coupled to a framework. She instead provides the same functionality with less restriction.
By providing decoupled components that behave like ordinary functions, by representing requests and responses as hashes, she doesn't tie you to complex interfaces that force you to stay with a framework.
Ultimately she provides you the flexibility to grow your application in whatever way you want by providing all the components you need without fencing you in a framework. With Lily you can compose a framework yourself.
Installation
Installing Lily through composer is easy. Just create a
composer.json
file in a new directory for your application:
{ "require": { "drpheltright/lily": "~0.7.0" } }
Now run the following command in that directory:
curl -s https://getcomposer.org/installer | php && php composer.phar install
Done!
Documentation
Tests
To run the test suite, you need composer and it will handle the rest. Lily unit tests are written with PHPUnit.
php composer.phar install --dev
vendor/bin/phpunit
We try and keep coverage high and no feature is added without some kind of test.
Development
All development should be done via GitHub Issues. New features should
be suggested/planned there and can be identified by the feature
tag. Also bugs
should be reported with the bug
label.
I'd like some development help with new features. I've labelled the features
that people are welcome to hack at with please help
. If a task isn't labelled
please just comment to ask if you want to help out.
Features must be tested before pull requests opened.
License
Copyright © 2014 Luke Morton
Distributed under MIT. See LICENSE distributed with Lily for more information. TL;DR, Keep the license found at the top of each Lily file with significant chunks of code you want to reuse.