Skip to content

Create PHP5 Project

Joao Gilberto Magalhães edited this page Apr 17, 2014 · 3 revisions

The easiest way to start a fresh new Xmlnuke php project is to run the script "create-php5-project.php" provided by the Xmlnuke package. This script create a default directory structure and define some standards.

Before to proceed Install XMLNuke, the web server and PHP CLI and the proper PHP extension (php fpm, lib mod apache, etc)

Linux / Mac / BSD

The best option is to install a default LAMP stack. After that, follow the instructions:

  1. Open the terminal
  2. Create a folder for your project, e.g. /home/user/MyProject
  3. Run the command:
$ php /path/to/xmlnuke/create-php5-project.php /home/user/MyProject ProjectName en-us pt-br

Where:
- /home/user/MyProject is the local folder where the project will be located
- ProjectName is the name of in the PHP
- en-us, pt-br is the language pre configured

Setup your web server to point to /home/user/MyProject/httpdocs. This is can be done with Alias ou Vhost.

Windows

If you are not in a production envinroment I suggest you install the Xampp or Wampp

  1. Within the Explorer create a folder for your project, e.g. C:\Users\MyProject
  2. Open the command prompt (cmd)
  3. Run the command:
C:\> c:\xampp\bin\php c:\path\to\xmlnuke\create-php5-project.php C:\Users\MyProject ProjectName en-us pt-br

Where:
- C:\Users\MyProject is the local folder where the project will be located
- ProjectName is the name of in the PHP
- en-us, pt-br is the language pre configured

Setup your web server to point to C:\Users\MyProject\httpdocs. This is can be done with Alias ou Vhost.

Understanding the directory structure

The basic structure have the following directories:

data

Contains all definitions of the project:

  • anydataset - All anydataset files. The most important are _db.anydata.xml for connecting to relational databases and _configemail.anydata.xml for setup emails used by the class MailUtil for sending emails.
  • cache - store all cache files if the parameter "xmlnuke.XSLCACHE" is set to \Xmlnuke\Core\Cache\FileSystemCacheEngine
  • lang - All language files
  • snippet - your custom snippets
  • xml - your static xml files
  • xsl - your xsl files

httpdocs

Contains all static files of your project like CSS, JavaScript, Images, etc. Need to have an index.php and the xmlnuke.inc.php at least.

lib

Contains your php files. Remember that XMLNuke is full PSR-0 compliant.

nbproject

If you are using Netbeans you have a pre-configured project.

codegenx

Contains a set of files used by the codegenx a code generator based on XML/XSLT.

Clone this wiki locally