Starting a new project with Cubex framework in PHP Storm

Using PHP Storm to create a new project using the Cubex Framework.

In PHP Storm

Starting with File > New project.

You need to do three things:

  1. give the project a name
  2. choose a location
  3. choose a project type

The first two are up to you, for the project type, choose “Composer project”.

Next you will be asked if you want to use your existing composer or to download composer.phar from, choose whats best – you may have composer already installed, mine is in /usr/bin/composer, so i choose use existing composer.phar and enter /usr/bin/composer (which phpStorm validates :))

From the Available Packages, choose cubex/project, and then in Version to install select dev-master (this will of course change when a stable release comes).

Ok. phpStorm will do its magic and set you up a project.

Run composer install

Next go into the project directory:

[code]cd /Users/stuart/Sites/cubexDev/[/code]

and run composer install:

[code]$ composer install[/code]

You’ll see composer successfully install and generate all the necessary files:
Loading composer repositories with package information
Installing dependencies
– Installing cubex/figlet (dev-master c8a4b58)
Cloning c8a4b58458daffb096cf4a70ff42b5626055efbd

– Installing psr/log (1.0.0)
Downloading: 100%

– Installing cubex/cubex (dev-master 7b11c3b)
Cloning 7b11c3b3f9718acddb45509e0372f84d8cf1a316

– Installing bundl/debugger (dev-master a6718db)
Cloning a6718db03698a6d3ce4da6dedf1005f7169a54f3

cubex/cubex suggests installing mobiledetect/mobiledetectlib (Supported platform detection library)
cubex/cubex suggests installing phpseclib/phpseclib (PHP Secure Communications Library – Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.)
cubex/cubex suggests installing cubex/cassandra (Cassandra Connections)[/code]

Setting up your Virtual Host

You will also need a vhost container for your project, but you know that :)
An environment variable needs setting:

SetEnv CUBEX_ENV development[/code]

and also a simple rewrite rule to route everything through index.php:

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ index.php?__path__=$1 [L,QSA]

Just for clarity, my vhost looks like this: (though i use a script to generate mine, there may be parts you do not need)
<VirtualHost *:80>
DocumentRoot "/Users/stuart/Sites/CubexProject2/public"
ErrorLog "/Users/stuart/Sites/CubexProject2/logs/error_log"
CustomLog "/Users/stuart/Sites/CubexProject2/logs/access_log" common
<Directory /Users/stuart/Sites/CubexProject2/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all


then restart the Apache.

A Hostname

One other thing my script does is set up a hostname for this, so i can access it locally .

This is done in /etc/hosts:


Browse to your hostname (mine is for instance) and you are ready to go.

The next posts in the Cubex category will be tutorials based on my learning of the framework.

No Comments

You can leave the first : )

Leave a Reply

Your email address will not be published. Required fields are marked *