Small and fast PHP framework usable for practically any small PHP project. Contains MySQL and MongoDB support, data crypting and automatic caching with Memcached.
- 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.
- PHP 5.3.
- Optional: mcrypt extension is required for encryption.
- Optional: memcached extension is required for caching.
- Optional: PDO extension with MySQL driver is required for MySQL usage.
- Optional: MongoDB extension is required for MongoDB usage.
- Download the source files (as zip or tar.gz or clone this repository).
- 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 thecookie_name
andabsolute_url
values. - Point your server to
public_html
. - You're good to go!
- Follow the steps from How to start.
- Rename appropriate file from
app/models
tousersModel.php
(for example, if you want to use MongoDB, renameusersModel_mongodb.php
tousersModel.php
). - Refer to the chosen model file for information how to add an example login data to your database.
- 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
ormongo_db_host
andmongo_db_port
, optionally alsomongo_db_user
,mongo_db_pass
.
- Open the page, example login data is - login: test, password: test.
- 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!
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.
Simple tutorial is available in TUTORIAL file.
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:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
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.