[Deprecated] A MVC style PHP 5.3.0 Framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


WALLEYE - An MVC style PHP framework based on PHP 5.3.0

How to use the framework

Set up the configuration options in includes/app/app.php, includes/app/routes.php and includes/app/db.php.

Set up mod_rewrite to point all requests to httpdocs/index.php unless the resource exists.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Everything starts with index.php in the httpdocs folder.

The file creates a new instance of Walleye, sets the options and starts the app. This should always be the same process.

The Walleye class (walleye.php) is found in includes/core. The Walleye class is a singleton. Its main job is to perform the routes found in includes/app/routes.php. The routes are key/value pairs. The key is a regular expression and the value is the controller that should handle that route (aka url). So, the Walleye class performs the route by looping through the routes array until it finds a match then passes control over to a specific controller.

Each controller extends includes/core/walleye.controller.php which requires each controller to have a doHandler() function. There is a generic doHandler() function in Controller that can be used.

ex. /user/login will go to the user controller and should perform the handler login.

The specific controller does not attempt to handle the business logic. This is handled by a model. In the case of logging in a user, the User (walleye.user.php) model will be used. The controller attempts to create a new Walleye_user by passing a username/password pair to the constructor (it's a static function that returns an instance of self). If a new User is correctly authenticated then the the controller will set the logged in user with a function in User.

After the login is finished server-side, the browser needs a page to be rendered to the user. This is handled by Controller (walleye.controller.php). Each controller you create should extend this class. The class Controller contains a function called view($view, $values). When you call this function you need to pass a specific view that should be defined in the Walleye class and the necessary values for that view.

Once the controller calls view, the view is rendered through the php includes function. The application is finished server-side.


A class in /includes/core/ called walleye.database.php is used for all interaction with the database. Before using this class the server, user, password, and database must be set in includes/core/walleye.config.php.

The WalleyeDatabase class itself is simply an extension of MySQLi and can be created with the following line:

$db = WalleyeDatabase::getInstance();

Now you have all the functions available to you through MySQLi. You can change the database that you are connecting to by passing the name as a parameter.

$db = new WalleyeDatabase::getInstance('test_db');


Server-side logging is performed through the Console class (walleye.console.php). The file and line should be passed with each log unless you are logging an error (the Exception object will contain that information).

WalleyeConsole::log('this is a message to be logged', __FILE__, __LINE__); WalleyeConsole::logError('this is an error'); WalleyeConsole::alert('this is a message to be sent to the browser'); WalleyeConsole::logQuery('SELECT id FROM Users');


Email can be sent via a template or a simple string. The values in a template (greeting.txt for example) should be marked as follows: #{value}

Hello #{username}, How are you? love, #{admin} After creating your template file you can send the email with the following code:

$email = WalleyeEmail::withTemplate($to, $subject, 'greeting.txt', array('username' => 'Jon', 'admin' => 'Bob')); $email->send();

or without a template:

$email = WalleyeEmail($to, $subject, 'This is an email'); $email->send();


Ruckusing-Migrations included


Capistrano template included