PHPZevelop Logo


A PHP framework for speeding up development by 1000%... probably. PHPZevelop is ready for you to design and add pages to your new site, while taking care of all the complicated bits! And comes with a built in CMS that configures itself based on your MySQL database automatically.

PHPZevelop features Download on GitHub


Adding pages

By placing *.php files in the "pages/" directory they will be accessable through the URL by using the page name without the ".php" extension.

If the file is placed inside a directory within "pages/" then you can access it by using a "/" to delimitise folder names in the URL to access it.

Eg. this file lives here:


.. and is being accessed through the URL by:


Default pages

If you were to go to /help you would get a 404 error because even though the directory "help/" exists, it is not a readable page. If you would like "help/" to show a page you can create any of the pages found in the $CFG array in "/config.php":

"DefaultFiles" => array("index", "default", "home")

.. in the "help/" directory.


The main config file is "config.php", placed in the root directory.

As $PHPZevelop->CFG is an object, values can be returned by using the following format:

echo $PHPZevelop->CFG->SiteTitle;
echo $PHPZevelop->CFG->DB->Host;

Configuration can be overwritten in the site directory "config.php". This could be nessesary for overwriting default configuration in MultieSite site, you can also change configuration per page, more information here: help/meta-data

Below is an explanation of the available values

SiteTitle: This will be displayed in the title of each webpage, and can be used else where in the site.

PageTitle: Default page title

MetaTitle: Default meta title

MetaDescription: Default meta description

MetaKeywords: Default meta keywords

Site: The directory that your site data belongs in

MultiSite: Other site configuration directories

PassParams: If true, parameters can be passed to all pages. For more options check URL data

PreParam: Parameters passed will be accessable with this property and then an integer. For more information check URL data

Page404: This will define the 404 page to load if the URL cannot be found. For more information check Undefined URL's

DefaultFiles: An array of files that can be used as home pages, or default fallback files. For more information check Adding pages

LoadStyle: Should be set to either "Template" or "FileOrder". For more information check Load style

Template/FileOrder: Linked with "LoadStyle". For more information check Load style

Load style

There are two methods of loading your page and layout, "Template" and "FileOrder" mode. To change mode you can set the "LoadStyle" property of $PHPZevelop->CFG either in "config.php", "site/config.php" or on individual pages.

"Template" mode (Default)

To use this mode "LoadStyle" will need to be switched to "Template" mode and the default "Template" must be set. Your config must be setup at any of the three locations with the following data:

"LoadStyle" => "Template",
"Template"  => "main" // "main" can be changed to any  file in "site/templates"

The template file in "templates/" should contain the entire page from top to bottom, the page content found in "pages/" can be echoed to the page wherever you require it using:

PageContent; ?>"); ?>

This page has been swapped to "FileOrder" mode at the top of the file by overriding the CFG object data. It should say "(FileOrder mode)" in the header to demonstrate that it's working.

"FileOrder" mode

To use this mode "LoadStyle" will need to be switched to "FileOrder" mode and the default "FileOrder" must be set. Your config must be setup at any of the three locations with the following data:

"LoadStyle" => "FileOrder",
"FileOrder" => 

Note that "FileOrder"'s value should be an array, and that each element should contain the path to the correct file relative to the site it's contained in. To insert the page file use the [page] parameter, this will inject the current page in to the correct location amongst the file order.

Meta data

To change the default meta data for the framework you can change the values in "config.php":

"PageTitle"		=> "",
"MetaTitle"		=> "PHPZevelop PHP FrameWork",
"MetaDescription"	=> "PHP framework for ease of use and adaptability",
"MetaKeywords"		=> "PHP, Framework, Zephni"

These definitions can be placed in individual pages so the defaults can be overwritten, for example at the top of this file it uses:

	/* Page setup
	$PHPZevelop->OverrideObjectData("CFG", array(
		"PageTitle"  => "MetaData"

.. so as you can see the title of this page is now the site title (Which is set in "global.php") followed by a " - " and then the $PHPZevelop->CFG->PageTitle. If no page title is passed and the default page title is set to an empty string, only the site title will appear. If you wish to override any of the way the title appears, it can by edited manually on line 7 of "inc/header.php":

echo $PHPZevelop->CFG->SiteTitle.($PHPZevelop->CFG->PageTitle != "" ? " - ".$PHPZevelop->CFG->PageTitle : "");


Just as the main site has been placed in the "site/" directory, you can arrange multiple sites based off the same configuration. To add/remove these sites you can manage them by adapting the MultiSite property when istantiating the config object in "/config.php":

	"MultiSite" => array("admin", "site2", "site3");

The above example means that if "/admin" is the first part of the path (after the domain) PHPZevelop will look inside the "admin" directory for a site to load rather than the standard "/site" path. If you require an alias for the path you can use the below solution, note that the key MUST be a string and not an integer.

	"MultiSite" => array(
		"example1" => "directory",
		"example2" => "directory1/directory2"

The number of MultiSites is limitless, the key (eg. "example1" above) is the path you will need to append to your domain to access the MultiSite, where as the value ("directory" above) is the directory that the site is contained in (just like the standard "site" directory).

A MultiSite can be placed as deep in the directory structure as needed, or just in the root, whatever suits your arrangement best.

Important note for numeric multisites

If you are not specifying the keys seperately and wish to contain your MultiSite directory with a numeric name eg. "1" this will work, eg:

	"MultiSite" => array("admin", "1", "2");

However if you want to specify a MultiSite alias as a number then you will need to preceed it with a forward slash "/" eg:

	"MultiSite" => array(
		"admin" => "admin",
		"/1" => "directory1",
		"/2" => "directory1/directory2"

This is necessary because PHP considers strings that represent integers AS integers, so it cannot properly tell the difference between the two, this is why PHPZevelop uses the forward slash to tell it that this is an alias and not an automatically generated numeric key.


The file structure for PHPZevelop is as follows:


site/: For all the files regarding your website

phpzevelop/: Contains dependant PHPZevelop files

.htaccess: Is a set of rules for the working of the framework

config.php: Main configuration

index.php: Brings together the framework for usage

Site structure

The standard site structure is as follows, same is applied for additional MultiSites.


classes/: All classes in this directory will be included by default from global.php

css/: .css files for site styling.

scripts/: A directory for JavaScript files, by default JQuery is instantiated and "scripts/main.js" is called from "inc/header.php"

templates/: Template files should be placed here. See more here.

config.php: You can override config properties here. All pages loaded in the containing site will have the same config applied.

global.php: For any site specific code. By default this file runs all specified include directories. See more here.

Undefined urls

You have a two options when dealing with undefined URL's:

Option 1 (Default): No pages accept parameters unless specified

This is a strict option that will not allow anything to be passed to pages through the URL, if you want to specify a page to be able to take parameters you can add:

"PassParams" = true

.. to the OverrideObjectData array at the top of the page. To see this in action have a look here. In Url data PassParams has been set to true in the configuration instance, so any parameters passed will be accessible on that page.

Option 2: All pages accept parameters unless specified

To use this method you simply have to make sure that the config file at "/config.php" has the following property set to true:

"PassParams" => true

To explain what this does.. say you have a page located at "/help/test.php" which can be accessed by simply using "/help/test" as a URL, if you were to put "/help/test/value1/value2" that page would be able to access them variables (as explained here).

Also if you didn't have a page at "/help/test.php" then using the same URL as above would return all of them parameters to the home or index page.

If you wish to have a specific page that doesn't allow parameters through you would have to add the following to the top of the page in the OverrideObjectData array:

"PassParams" => false

404 page

You can specify a 404 page to fall back on if PassParams is turned off and the page passed does not exist, for more information check here: configuration.

Url data

Using PHPZevelop you can pass variables through the URL in two different ways.

Option 1 - Pretty URL's

Imagine you have a page that exists in the following location:


You can access this by going to:


PHPZevelop will pass back that page. But if you pass extra "/items" to that URL they will act as parameters to that page. Note that if a page exists at that location it will choose that instead.

By default the PassParams option in "/config.php" will disable this functionality but can be turned on by setting it to true on individual pages like this one, or it can be set to true by default. for more information click here.

When using this option, you will notice at the bottom of the page that $_GET contains the parameters passed through the URL. By default they will be indexed as "param_0", "param_1" etc, but this can be changed in the global file by changing $prependParam. If $prependParam is an empty string the parameters will be indexed as a plain integer instead of text.

Example, a page exists here:


By going to the following URL:


The test.php would be able to access all of the passed data like so:

// $_GET["param_0"] is equal to "someinfo"
// $_GET["param_1"] is equal to "somemoreinfo"

Option 2 - Standard format


After the "path" has been passed through the URL you can append variables using the pattern:


For multiple variables use:


You can then retrieve "value" by using $_GET["name"] inside your pages.

Main classes

Adding classes

By default the "site/initiate.php" file contains a snippet that automatically includes all the class files in the "site/classes/" directory.

NOTE: You can include all from other directories by appending the directory name string to the SubLoader->RunIncludes() parameter array, you may wish to do this with something like "functions". like below:

	$SubLoader->RunIncludes(array("classes", "functions"));

After this you should instantiate your class in the "site/initiate.php" file, something like below:

	/* MyClass
	$MyClass = new MyClass("Parameter1");

Here you should instantiate the object and configure it anyway that is necessary.

Database class


The class.db.php file must be included in the "classes/" directory for this class to be available.

By default the database class (which uses PDO) is configured in the "site/config.php" file and instantiated in the "site/initiate.php":

# file: site/config.php

/* Config
$PHPZevelop->CFG->DB = (object) array(
	"Host" => "",
	"User" => "",
	"Pass" => "",
	"Name" => ""

# file: site/initiate.php.php

/* Database connection
if(strlen($PHPZevelop->CFG->DB->Host) > 0){
	$DB = new db($PHPZevelop->CFG->DB->Host, $PHPZevelop->CFG->DB->User, $PHPZevelop->CFG->DB->Pass, $PHPZevelop->CFG->DB->Name);

If the host has not been set in the site/config.php then the database will not attempt to connect. If the the host property is set, then it will try to connect and die on error if it can't connect with a PDOExecption error message.


Query a single row from the database

$DB->QuerySingle("SELECT * FROM tablename WHERE id=:id", array("id" => 5));

The "QuerySingle" method is accepting two parameters here, a string and an array. The string (param 1) is the query, and field that is being tested against or changed must use an alias prepended by a ":" (colon) that will represent the value, this value can then be assigned in the array (param 2) by using the alias as the key, and the value as the value of the key

You would also use "QuerySingle" to INSERT or to UPDATE:

$DB->QuerySingle("UPDATE tablename SET name=:name WHERE id=:id", array("username" => "Zephni", "id" => 5));

By using this system which is a wrapper class of PDO, all values passed through as the second parameter will be escaped appropriately.

To query and return multiple rows just replace "QuerySingle" with "Query":

$DB->QuerySingle("SELECT * FROM tablename ORDER BY id DESC");

"QuerySingle" will return an array with key=>value elements, where key is the column name, and value is the value in that row. "Query" will return an indexed array with key=>value elements. So after making a multi-row "Query" you could loop through the results by using:

// Query tablename
$data = $DB->Query("SELECT id,name FROM tablename ORDER BY id DESC");

foreach($data as $item){
	echo $item["name"]."<br />";

Path class

The Path class is for getting a full path to a specified file.


object $CFG is the already defined $PHPZevelop->CFG object (This is required in the Path constructor)


GetClass(string $string, bool $return = true): Returns / Echos $PHPZevelop->CFG->RootDirs->Classes."/".$string

GetInc(string $string, bool $return = true): Returns / Echos $PHPZevelop->CFG->RootDirs->Inc."/".$string

GetImage(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDirs->Images."/".$string

GetPage(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDir."/".$string

GetPageRoot(string $string, bool $return = true): Returns / Echos $PHPZevelop->CFG->RootDirs->Pages."/".$string

GetScript(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDirs->Scripts."/".$string

GetCSS(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDirs->CSS."/".$string


To get the local URL for a page in pages/ you could use:


If the page was multiple levels deep you can use:


Note the second parameter of each method has a $return boolean that determines whether the method will "return" the value or "echo" the value. If you would like the value to be stored or used within a PHP script then you would pass "true" as the second parameter if "true" isn't the default (shown above):

$PHPZevelop->Path->GetPage("articles/article-name", true);

Where-as if you need the path string to be echo'ed directly to the page you would pass false as the second parameter, or leave blank in cases where $return is false by default:

<a href="<?php $PHPZevelop->Path->GetPage("article"); ?>">Link text</a>

Extending path class

You may want to extend the path class for your own usage, in this case put your path class file inside the "site/classes/" directory and use the following syntax:

class MyPath extends Path
	// Methods

You can then overwrite the $PHPZevelop Path object by calling:

$PHPZevelop->NewObject("Path", new MyPath($PHPZevelop->CFG));
.. In the site/instantiate.php file.

Phpzevelop class

The PHPZevelop class is simply a collection of PHPZevelop dependant objects that are fundamental to the workings of the framework.

class PHPZevelop
	private $InternalData = array();

	public function NewObject($Alias, $Object)
		$this->$Alias = $Object;

	public function OverrideObjectData($Alias, $NewData)
			foreach($NewData as $Key => $Value)
				$this->$Alias->$Key = $Value;

	public function Set($Key, $Value)
		$this->InternalData[$Key] = $Value;

	public function Append($Key, $V1, $V2 = null)
		if($V2 === null)
			$this->InternalData[$Key][] = $V1;
			$this->InternalData[$Key][$V1] = $V2;

	public function Get($Key)
		if(array_key_exists($Key, $this->InternalData))
			return $this->InternalData[$Key];
			return null;


AddObject(string $Alias, object $Object):

The "NewObject" method is for adding an already instantiated object as an accessible property of PHPZevelop. For instance "Page" is a class that PHPZevelop relies on, this is added to PHPZevelop by using:

$PHPZevelop->NewObject("Page", new Page());

You can change the name of the property by changing the first parameter string value, the second parameter is the instantiated object itself. A property can by overwritten by applying a new object to the same string value. An example of why you may do this can be found here.

OverrideObjectData(string $Alias, object $NewData):

OverrideObjectData will loop through the $Alias object and ammend the properties with the new values in an array like so:

array("Key" => "PropertyName", "Value" => "NewValue")

see more here: Meta data.

Append(string $Alias, string $V1, string $V2 = null):

Append will add an array element to an already existing one, the first parameter is the key of the item you want to append to. The second parameter is the item to append. If the third parameter is passed it will set the key and value of the new element with the second and third parameter respectively.

Set(string $Key, string $Value) / Get(string $Key):

The set and get methods are just for adding and returning elements of an private internal array, you can use this for global variables.

Subloader class

A class for simplified inclusion of mass files. For example, pass it a directory, or a list of directories as an array to recursively include all files inside those directories.

Public properties

array $DefinedVariables = array();	// An array of variables to pass to the included files
array $IncludedFiles;			// List of successfully included files after RunIncludes() has ran
array $ErrorFiles;			// List of unsuccessfully included files after RunIncludes() has ran


If you wanted to include all PHP files in the "site/classes" directory, use the below:

1. $SubLoader = new SubLoader($PHPZevelop->CFG->SiteDir);
2. $SubLoader->RunIncludes(array("classes"));
3. extract($SubLoader->DefinedVariables);

Line 1 is intantiating the SubLoader class, the constructor takes the root path of the website.

Line 2 is running the includes, the parameter can be a string or an array of strings that represent the directory names.

Line 3 is extracting the variables that may have been in the files that were included.