System Requirements
We have a strict set of rules to use Arch PHP. We believe that you should have a architecture that is always able to run the latest versions of software, and not be stuck running a older version because your framework has become so massive that it's takes 6+ months before you can think about upgrading. [see about for more]
We're already planning for PHP 5.4 and will be ready when it's released.
These versions are recommended.
- PHP 5.3+
- APC
- Apache
- Zlib.output_compression
- Linux
Apache Required Settings
mod_rewrite enabled httpd.conf file needs to have this directive AllowOverride All TURN OFF INDEXES RECOMMENDED instead of putting a ton of /index.php files in each directory. -INDEXES
PHP.INI Settings
mail() function enabled zlib.output_compression enabled allow_url_fopen disabled display_errors disabled (0) display_startup_errors disabled (0) log_errors enabled (1) error_reporting E_ALL | E_STRICT expose_php disabled (0) magic_quotes_gpc disabled (0) magic_quotes_sybase disabled (0) register_globals disabled (0)
Optional Components
MongoDB enabled MySQL/PDO enabled
Just some links
System Requirements
Getting Started
Configure Settings
Arch PHP Core Functions
Using Optional Core Plugins
Using Advanced Core Plugins
And more links
Home
How it Works
Documentation
Video Tour & Tuts
About
Powered by




Getting Started
Download Arch PHP
https://bitbucket.org/securebucket/arch-php/downloads
or
git clone https://securebucket@bitbucket.org/securebucket/arch-php.git
Unpack and Place the public contents in your folder that is accessible from the web.
Next, place the private folder in a area that isn't accessible from the internet.
/private/ // stores anything that is not suppose to be accessed from the internet. /public/ // stores anything meant to be public.
Verify your Apache mod_rewrite is working.
http://youdomain.com/ # if you get a 404 page not found. You probably don't have AllowOverride set to ALL. # If you see "setup needed". You are ready to move on.
Just some links
System Requirements
Getting Started
Configure Settings
Arch PHP Core Functions
Using Optional Core Plugins
Using Advanced Core Plugins
And more links
Home
How it Works
Documentation
Video Tour & Tuts
About
Powered by




Configure Settings
In the public folder. Rename config.sample.php to config.inc.php
config.sample.php to config.inc.php
Open the file and go down the list of settings.
# Set your name define('ADMIN_NAME', '{YOUR NAME}'); /** * mySQL Database Info */ // Database User Name define('DB_MYSQL_DBUSER', ''); // Database password define('DB_MYSQL_DBPASS', ''); // Database Name define('DB_MYSQL_DBNAME', ''); // database host define('DB_MYSQL_HOST', 'localhost'); // database type define('DB_MYSQL_TYPE', 'mysql'); /** * MongoDB Database Info */ // Database Username define('DB_MONGODB_DBUSER', ''); // Database Password define('DB_MONGODB_DBPASS', ''); // Database Host define('DB_MONGODB_HOST', 'localhost'); /** * Core Directory Configurations */ // Store files not meant to be accessed publicly. define('DIR_PRIVATE', '../private/'); // Stores the core files used by Arch PHP define('DIR_CORE', DIR_PRIVATE . '_core/'); // Stores the core files needed to run arch. define('DIR_CORE_REQUIRED', DIR_CORE . 'plug-ins/_required/'); // Stores the core plugins that are optional. like mysql, mongodb, images define('DIR_CORE_OPTIONAL', DIR_CORE . 'plug-ins/optional/'); /** * Your Directory Configurations */ // Stores your Controllers. This directory will never be touched by updates. define('DIR_CONTROLLER', DIR_PRIVATE . 'mvc/controllers/'); // Stores your Models. This directory will never be touched by updates. define('DIR_MODELS', DIR_PRIVATE . 'mvc/models/'); // Stores your Models. This directory will never be touched by updates. define('DIR_VIEWS', DIR_PRIVATE . 'mvc/views/'); // stores the css files that will be included in all pages. define('DIR_VIEWS_CORE_CSS', DIR_VIEWS . '_core/css/'); // stores the js files that will be included in all pages. define('DIR_VIEWS_CORE_JS', DIR_VIEWS . '_core/js/'); // Stores your custom plugins. DIR_VIEWS . "_core/css" define('DIR_PLUGINS', DIR_PRIVATE . 'plug-ins/'); // Stores the media information. Publically accessible. define('DIR_MEDIA', 'media/'); define('DIR_IMAGES', DIR_MEDIA . 'images/'); // font files are used for watermark over images. define('DIR_FONTS', DIR_MEDIA . 'fonts/'); // vault for original images (before processed) define('DIR_VAULT_ORIG_IMAGES', DIR_PRIVATE . 'vault/images/'); /** * Optional Modules to Load */ // this will load the integrated mysql class. Uses PDO. define('CORE_OPT_PLUGIN_MYSQL', '0'); // Loads the integrated mongodb class. // Caching System works with this. (Recommended) define('CORE_OPT_PLUGIN_MONGODB', '0'); // Loads the integrated mongodb class. // Caching System works with this. (USE MONGO GRIDFS INSTEAD) define('CORE_OPT_PLUGIN_FILES', '0'); // Loads the integrated image manipulation class. // This is recommeded to process images in a cron. // Store Images in GridFS mongodb. (optional) // @todo: this is still in development define('CORE_OPT_PLUGIN_IMAGE', '0'); /** * CSS / Javascript | Combine, compress, and print. * array(),array() */ // css files in array define('CORE_HTML_INCLUDE_CSS', ''); // reset.css,stylesheet.css // js files array define('CORE_HTML_INCLUDE_JS', ''); // 'jquery-1.3.2.min.js,global.js,jquery.idTabs.min.js,easySlider1.7.js'
Now check that the settings are configured correctly.
http://yourdomain.com/ # if you see 'all is running' YOUR ARE GOOD TO MOVE ON. If not, it will tell you what is configured incorrectly.
Just some links
System Requirements
Getting Started
Configure Settings
Arch PHP Core Functions
Using Optional Core Plugins
Using Advanced Core Plugins
And more links
Home
How it Works
Documentation
Video Tour & Tuts
About
Powered by




Arch PHP Core Functions
To protect from duplication of instances or multiple wasteful calls. Arch PHP offers a class loader. The example below shows the proper way to call it.
// If arch::cls('CLASS_NAME') has already been activated then it will return the instance. <?php arch::cls('CLASS_NAME'); // starts the instance. Must be called before any method calls. arch::cls('CLASS_NAME')->methodCall(); // now you can call your methods. ?> // If you need to change the name of the instance you can do the following. <?php arch::cls('ClassName','NewNameInstance'); arch::cls('NewNameInstance'); // you would then call the above by doing. ?> // There is no need to do the following. <?php // wasteful $classvar = arch::cls('CLASS_NAME'); ?>
Arch PHP has changed the way you handle outside variables. It removes _POST _GET style variables. When you need one of these variables. Instead you will call
evar::{TypesOfVars}(‘variablename’, $format); // Current Available TypesOfVars evar::post(‘variableName’); // grabs _POST evar::get(‘variableName’); // grabs _GET evar::request(‘variableName’); // grabs _REQUEST evar::server(‘variableName’); // grabs _SERVER evar::cookie(‘variableName’); // grabs _COOKIE evar::session(‘variableName’); // grabs _SESSION Format Options for above functions. int = returns only the numbers in the var. ip = will only return numbers and periods from the var. text = strips all html tags using strip_tags() char = AlphaNumeric characters, and spaces are returned. field = AlphaNumeric characters, hyphen, underscores are the only thing returned. url = AlphaNumeric characters, colon, forward slash, period, ampersand, question mark, percentage, equal, minus. default = char format If you need the original (ugh). You can use the below to obtain it. arch::cls("enforcer")->blocked["_POST"]["FIELDNAME"]; // the below will clean the string. Same way options above work. evar::CleanData(arch::cls("enforcer")->blocked["_GET"]["test"],'text');
Create your controller. This is placed in your controller folder and is the boot file. This is where all your http request will be sent if there is no file on the server to handle the request.
If you notice it has the css and js call functions. Arch will automatically combine all your files placed in the /view/core/js and /view/core/css folder.
You need to define what files to load in the config file.
// In the _boot.php file. It will send the url to this variable. evar::get('pageurl', 'url') // This is left very plain so you can determine what your needs are. Below is a example of the default use. <?php /** * This will retreive the url being passed in. */ switch (evar::get('pageurl', 'url')) { case 'media/css': header('Content-type: text/css'); echo views::MediaInclude('css', CORE_HTML_INCLUDE_CSS); exit; break; case 'media/js'; header('Content-type: application/javascript'); echo views::MediaInclude('js', CORE_HTML_INCLUDE_JS); exit; break; default: echo 'all is running'; exit; } ?>
Arch PHP also has a dependency checker for the class being loaded. You call the checker by using the following function. This allows you to outline what is needed and then if you are in a multi-server environment, you won't have to worry everything is setup to your specs.
if ( !arch::cls('SystemCheck')->depends( array( array('Mongo', 'class'), array('mongo', 'php-ext') ) ) ) // the above will return a false if those functions are not found. // Where you see it say 'Mongo'. This is the function name. Where it says 'class'. This is the type of search being checked. Your options for this are <?php switch ($type) { case 'class': if (!class_exists($name)) $failed = true; break; case 'function': if (!function_exists($name)) $failed = true; break; case 'php-ext': if (!extension_loaded($name)) $failed = true; break; case 'ini': if ((int) ini_get($name) != $value) $failed = true; break; } ?>
Views are called by using the Views Class
views::load('folder/file.php', $data, $returnVar); // @$data can be an array or a standard variable. // @$returnVar is a TRUE FALSE parameter. If set to true. it will return the output as a array. // ['content'] will be the content from the views. // In the views folder. you must have a /css/ and /js/ folder inside. If you put a file file in here. It will be placed at the bottom of outputted html page. -------------------------------------------------------- // The body of the website is place in the views/_core/template.php file. After compiling the output you then can place it in your template by doing. <?php views::load('_core/template.php', $data); ?>
Just some links
System Requirements
Getting Started
Configure Settings
Arch PHP Core Functions
Using Optional Core Plugins
Using Advanced Core Plugins
And more links
Home
How it Works
Documentation
Video Tour & Tuts
About
Powered by




Using Optional Core Plugins
Using MongoDB
// Turn on Mongo Plugin in the config.inc.php file. Change <?php define('CORE_OPT_PLUGIN_MONGODB', '0'); ?> // To <?php define('CORE_OPT_PLUGIN_MONGODB', '1'); ?> // Now set the MongoDB Info
/** * MongoDB Database Info config.inc.php */ // Database Username define('DB_MONGODB_DBUSER', ''); // Database Password define('DB_MONGODB_DBPASS', ''); // Database Host define('DB_MONGODB_HOST', 'localhost');
// Calling the plugin. It will be auto started when you set the config.inc.php parameter to 1. arch::cls('mdb');
// Example of inserting data. arch::cls('mdb')->selectDB("DATABASE_NAME")->{COLLECTION_NAME}->insert($data); // http://php.net/manual/en/mongocollection.insert.php
// Example of getting info from MongoDB $cursor = arch::cls('mdb')->selectDB("DATABASE_NAME")->docs->findOne(array('_id' => new MongoId($id))); print_r($cursor); // http://www.php.net/manual/en/mongocollection.findone.php
Using MySQL by using PDO
// Turn on MySQL Plugin in the config.inc.php file. // Change <?php define('CORE_OPT_PLUGIN_MYSQL', '0'); ?> // To <?php define('CORE_OPT_PLUGIN_MYSQL', '1'); ?> // Now set the MongoDB Info
/** * mySQL Database Info */ // Database User Name define('DB_MYSQL_DBUSER', ''); // Database password define('DB_MYSQL_DBPASS', ''); // Database Name define('DB_MYSQL_DBNAME', ''); // database host define('DB_MYSQL_HOST', 'localhost'); // database type define('DB_MYSQL_TYPE', 'mysql');
// Calling the plugin. It will be auto started when you set the config.php parameter to 1. arch::cls('sql');
// Example of inserting data. $sth = arch::cls('sql')->prepare('INSERT INTO users (`login`, `password`, `role`) VALUES (:login, :password, :role) '); $sth->execute(array( ':login' => 'testedasd', ':password' => 'password', ':role' => '' )); // http://php.net/manual/en/pdostatement.execute.php // http://www.php.net/manual/en/pdo.prepare.php
// Example of getting info from MySQL $sth = arch::cls('sql')->prepare('SELECT id, login, role FROM users'); $sth->execute(); $sth->fetchAll(); // http://www.php.net/manual/en/pdo.prepare.php
Just some links
System Requirements
Getting Started
Configure Settings
Arch PHP Core Functions
Using Optional Core Plugins
Using Advanced Core Plugins
And more links
Home
How it Works
Documentation
Video Tour & Tuts
About
Powered by




Using Advanced Core Plugins
Arch PHP has a preintegrated cache standard class. This Caching class will let you create your own class that will handle it the way you want.
// Turning on the cache class arch::cls('cache'); // Next name what class will handle the caching request. In this example I am going to use the integrated mongodb database. arch::cls('cache')->setclass('mdb'); // mdb is the class that is loaded when start. // next set the directory (if using a file style caching), or the table name if using a database. In this example we will use page as the table name. arch::cls('cache')->setPointer('page'); // Now you can you do the following to use the cache system. // this will insert/update. If the db row already exists. it will overwrite the cache. arch::cls('cache')->put($key, $data); // This will get the data that matches the $key field. arch::cls('cache')->get($key); // This will delete the data that matches the $key field. arch::cls('cache')->del($key);
Adding your own plugin. Add your files to the following folder.
/private/plug-ins/ // You must name the file ending with plugins.php // Let's say you add a file called url.splitter.php. You would change that to url.splitter.plugins.php
Just some links
System Requirements
Getting Started
Configure Settings
Arch PHP Core Functions
Using Optional Core Plugins
Using Advanced Core Plugins
And more links
Home
How it Works
Documentation
Video Tour & Tuts
About
Powered by




© Richard Wagener (securebucket.com)
All rights reserved.
Privacy Policy | Terms of Use