PHP Classes

Fox micro framework: Model View Controller micro-framework

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 281 All time: 7,607 This week: 66Up
Version License PHP version Categories
foxframework 1.0.6MIT/X Consortium ...5.4PHP 5, Libraries, Design Patterns
Collaborate with this project 

Author

fox - github.com

Description

This package is a model view controller micro-framework.

It provides base MVC classes to implement Web applications.

Currently it provides a router class that dispatches the request to a controller class based on the request URL, a view class that loads the current view script, a database access class, a configuration class to set environment variables, etc..

Picture of Joubert RedRat
  Performance   Level  
Name: Joubert RedRat <contact>
Classes: 2 packages by
Country: Brazil Brazil
Age: ???
All time rank: 2105138 in Brazil Brazil
Week rank: 227 Up20 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Example

<?php
/**
 * Frontend do app
 *
 * @author Joubert <eu@redrat.com.br>
 */

define('APP_PUBLIC_PATH', __DIR__);
define('FOX_PATH', implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'fox']));

require(
FOX_PATH.DIRECTORY_SEPARATOR.'bootstrap.php');

\
Fox\Lets::go();


Details

Fox

Fox is a MVC micro-framework written in PHP for building fast, simple and small applications. It emerged from a dark season, when I had issues with my internet connection and needed to do a simple test. Even away from contemporary world, from composer and from modern and cool libraries, I could still solve my problem :)

Install

  • `git clone https://github.com/joubertredrat/fox.git`
  • In your apache installation, set `public` folder as your document root and done, it's working!

In a near future, I will provide Fox through composer create-project

Features

  • Extremely slim: `fox` directory's size is only 124 KB.
  • Written in pure PHP: you don't need any external library to get it running.
  • Dynamic router to controller, (see How does it work?.
  • Composer friendly: you can add any library you want without trouble.
  • Object-Oriented Controller and Model (and View, maybe sometime later).

How does it work?

Fox has a Dynamic router, based on uri requests into public/index.php, as shown below:

/users/list-admin/br = request
                                ____________________________
                               | users == Controller\Users  |
request => index.php => router | list-admin == listAdmin()  | => Controller\Users->listAdmin(arg) => View
                               | br == arg <= br            |
                               |____________________________|

Todo

  • [ ] Provide this through `composer create-project`.
  • [ ] Decouple routing from Apache's mod-rewrite, so it could run with Nginx or PHP built-in webserver, for example.
  • [ ] Refactor View to OOP aproach.

  Files folder image Files (19)  
File Role Description
Files folder imageapp (4 directories)
Files folder imagefox (10 files)
Files folder imagepublic (2 files)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (19)  /  app  
File Role Description
Files folder imageconf (1 file)
Files folder imagecontroller (1 file)
Files folder imagemodel (1 file)
Files folder imageview (2 files)

  Files folder image Files (19)  /  app  /  conf  
File Role Description
  Accessible without login Plain text file .env Data Auxiliary data

  Files folder image Files (19)  /  app  /  controller  
File Role Description
  Plain text file index.php Class Class source

  Files folder image Files (19)  /  app  /  model  
File Role Description
  Plain text file Timestamp.php Class Class source

  Files folder image Files (19)  /  app  /  view  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script
  Accessible without login Plain text file timestamp.php Example Example script

  Files folder image Files (19)  /  fox  
File Role Description
  Accessible without login Plain text file autoload.php Aux. Auxiliary script
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file config.php Class Class source
  Accessible without login Plain text file constants.php Conf. Configuration script
  Plain text file database.php Class Class source
  Plain text file exception.php Class Class source
  Plain text file functions.php Class Class source
  Plain text file lets.php Class Class source
  Plain text file router.php Class Class source
  Plain text file view.php Class Class source

  Files folder image Files (19)  /  public  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:281
This week:0
All time:7,607
This week:66Up