CompleXml Framework - fast, flexible, performance, open source php framework. Used for fast developing web application on php 5 with xml technologies, like xslt, xpath, xinclude, etc. CompleXml free and open source, distributed by new BSD licence
CompleXml needs PHP >= 5.2.3, with libxml, xsl, xmlWriter, DOM/XML. For command line tools recommended readline php extension.
Registering the channel:
pear channel-discover pear.complexml.org
Installing a package:
pear install complexml/CompleXml
To install CompleXml need to download the archive at site http://complexml.org or get a copy of the svn repository
svn co http://complexml.googlecode.com/svn/trunk complexml
after receiving the package of frameworks, put the contents of the directory lib/ to the directory, the specified option in the settings of your php include_path and add to the configuration of this option is the way to CompleXml in php.ini, so include_path is possible to install before running the script for this before each launch script performs
set_include_path(get_include_path().PATH_SEPARATOR .'/path/to/CompleXml/lib');
To quickly get started with CompleXml, run the command from the directory ./bin
./cx create project firstproject
This command will create in the current working directory project called firstproject, if you want to copy in the lib directory of the draft copy of the framework, run
./cx create project firstproject --with-lib
In order to specify a different directory in which you want to create a project, use the command:
./cx create project firstproject --dir /path/to/workspace
From analogues CompleXml distinguish several features::
- Productive, extensible framework
- uilt on the design pattern MVC (Model - View - Controller), View of the framework is isolated from the model and the controller through the use of technology XML XSL.
- Deep using of reflection of language for solving a lot of tasks and problems
- Flexible cache solution.
- XSL support on browser side.
- "Honest" AJAX (asynchronous JavaScript + XML), response from server come in XML view
- Command line tools and classes for multi process application in console.
For quick start with CompleXml, call the command from ./bin directory
./cx create project firstproject
This command will create sandbox project named firstproject in current directory, for create project with framework sours in lib directory call this command:
./cx create project firstproject --with-lib
For make project not in current directory use this command:
./cx create project firstproject --dir /path/to/workspace
Note: In *NIX you can use alias console command for make your work more easy.
alias cx=path/to/CompleXml/bin/cx
After project created, we have a this directory structure in your working folder:
./firstproject #--> root application directory (APPLICATION_HOME)
application #--> application work files
controllers #--> controllers
indexController.php #--> main index controller file
errorController.php #--> error controller class
configs #--> configuration directory
models #--> models directory
~locales #--> symbol link to ./firstproject/public/locales (this link for more logic structure only)
~templates #--> symbol link to ./firstproject/public/templates (this link for more logic structure only)
cache #--> cache directory
configs #--> global config dir
main.ini.php #--> main settings file
cli.ini.php #--> command line settings
lib #--> library directory of project
logs #--> logs directory
public #--> DocumentRoot of web server
templates #--> xsl templates directory
index
index.xsl
error
notfound.xsl
locales #--> directory for xml localisation files
index.php #--> DefaultIndex file
.htaccess
cx #--> command line tool for manage project (unix style)
cx.php #--> php script for manage project
cx.bat #--> command line tool for manage project (windows style)
Note: symbol links to templates and locales в applications created on *NIX like systems only
For working with project our web server must use firstproject/public like DocumentRoot folder
Configuration of project located at firstproject/configs, main settings file is main.ini.php:
<?php
define('APPLICATION_HOME', dirname(dirname(__FILE__))); //path to main directory
//adding project lib directory to global include path
set_include_path(get_include_path().PATH_SEPARATOR.APPLICATION_HOME.DIRECTORY_SEPARATOR.'lib');
//getting CompleXml_Loader class
require_once 'CompleXml/Loader.php';
//registering CompleXml_Loader like autoload class
spl_autoload_register(array('CompleXml_Loader', 'autoload'));
...
After APPLICATION_HOME was defined and autoload was registered, we can set our specific project parameters using CompleXml_Config:
//setting array to config
CompleXml_Config::setArray(
array(
'foo'=>'bar',
'test'=>'test'
)
);
$foo = CompleXml_Config::get('foo'); //return "bar"
//setting single parameter
CompleXml_Config::set('param', 'value');
