Skip to content
/ wave Public

Extensible PHP framework using packages, internal events, resources and much more.

License

Notifications You must be signed in to change notification settings

lafka/wave

Repository files navigation

	__        __                ____  _   _ ____  
	\ \      / /_ ___   _____  |  _ \| | | |  _ \ 
	 \ \ /\ / / _` \ \ / / _ \ | |_) | |_| | |_) |
	  \ V  V / (_| |\ V /  __/ |  __/|  _  |  __/ 
	   \_/\_/ \__,_| \_/ \___| |_|   |_| |_|_|    

	A quick and uncluttered way to setup a structure for routing requests.
	Wave can be though of as a mini-toolkit with a autoloader implementation,
	it makes structuring multiple libraries/frameworks together an easy task
	and allows developers to focus on the business logic rather than trying
	to make the tools behave they want.


	INSTALL    ======================================================

	To install, pull this down to your web server 

	$ git clone https://[email protected]/lafka/Wave.git

	Create a link of the index file
	
	$ ln -P Wave/index.php .


	Add the rewrite rules you need:

	# NGINX

	    if ( !-e $request_filename )
	    {
	        rewrite ^/(.*)$ /index.php last;
	    }

		# In your php_fpm call add this:
            fastcgi_param WAVE_ENV production

    # APACHE

        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} \.php$ [OR]
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f 
        RewriteRule . /index.php  [L] 

		# Valid is production,stage,dev - if none is set production is assumed
		SetEnv WAVE_ENV production

                                             
	FIRST STEPS   ======================================================

	Create a new package with some routes:

	mkdir -p MyPkg/{Hello,Goodbye}

	Create the router for it	
	
	touch !$/Route.php

	A controller must be in the namespace that corelates to the path, so
	your controller would be named \MyPkg\{Hello,Goodbye}\Route. The route
	will also need to implement \Wave\Route\Iface. A stripped router would
	look something like this (RegEx route is a predefined route which can be
	used to match Regexes with the URL):

	namespace MyPkg\Hello;
	use Wave\Route\Iface as RouteInterface, Wave\Route\Regex as RegexRoute;

	class Route extends RegexRoute implements RouteInterface {
	{
		protected $regex = '~/(?hello|good-?day)~i';

		public function dispatch ($uri) {
			echo "Good day to you!";
		}
	}

	This matches all request that starts with hello, good-day or goodday.

About

Extensible PHP framework using packages, internal events, resources and much more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages