Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Small and fast PHP framework usable for practically any small PHP project. Contains MySQL and MongoDB support.
PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
docs
public_html
tests
README.md
TUTORIAL.md

README.md

5-minute PHP framework

Small and fast PHP framework usable for practically any small PHP project. Contains MySQL and MongoDB support, data crypting and automatic caching with Memcached.

Features

  • Fast (almost no overhead) and small (only 150KB of core files).
  • Minimal memory usage with lazy-loading system prevents unneeded files from being loaded.
  • MVC-based with simple template system.
  • Supports MySQL and MongoDB databases out of the box (both can be used simultaneously).
  • Can be easily extended with almost any database support, transparently to the rest of the code.
  • Encrypts and decrypts (automatically) data passed to the database (encrypting can be defined for each model separately).
  • Automatically caches database results with Memcached.
  • Allows for basic access restrictions to each controller based on IP address.
  • Supports AJAX requests.
  • Contains example of a simple user's object allowing to login the user.
  • Easy to maintain and improve.

Requirements

How to start

  1. Download the source files (as zip or tar.gz or clone this repository).
  2. Optional: edit the public_html/index.php file to adjust config settings: refer to inline documentation for more details on config values. You may want to set the cookie_name and absolute_url values.
  3. Point your server to public_html.
  4. You're good to go!

How to see the build-in example

  1. Follow the steps from How to start.
  2. Rename appropriate file from app/models to usersModel.php (for example, if you want to use MongoDB, rename usersModel_mongodb.php to usersModel.php).
  3. Refer to the chosen model file for information how to add an example login data to your database.
  4. Add appropriate config settings concerning your database to index.php:
    • For MySQL: mysql_db_host, mysql_db_port, mysql_db_user, mysql_db_pass.
    • For MongoDB: mongo_db_socket or mongo_db_host and mongo_db_port, optionally also mongo_db_user, mongo_db_pass.
  5. Open the page, example login data is - login: test, password: test.

FAQ

  • How to use automatic caching?

Set the memcache_host config value to appropriate memcache host (memcache_port is also available if needed). That's all.

  • How to use models data encryption?

Change crypt_std_key value to any key you want (with the same lenght) and set $_crypted value in appropriate models to true. Also, remember to encrypt all data before inserting it to the database (it will be decrypted automatically). Refer to usersModel_ files for example.

  • How can I use restriction of access for specific controllers?

See the appConfig.php file for information on restrict config key. Basic usage:

"restrict" => array(
    "admin" => array(       
        "127.0.0.1", 
        "::1", //127.0.0.1 in ipv6   
    )
)

This will restrict access to the controller named "admin" only to users connecting from localhost.

  • What should I do next?

You may want to refer to the documentation of appConfig::$_defaults variable for more information about the config settings.

  • And after that?

Code!

Documentation

The whole code is fully-documented and pre-generated HTML documentation can be found in docs/ directory. If you'd like to browse it online, please visit GitHub pages for this repository for information where to find it.

Tutorial

Simple tutorial is available in TUTORIAL file.

License

Licensed under BSD 2-Clause License.

Copyright © 2011 - 2012 Paulina Budzoń. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Something went wrong with that request. Please try again.