Download Instructions

This tutorial will explain the installation process via Composer, which is recommended. However if you don’t wish to use it, you can always download the latest snapshot of PHPixie.

Getting Composer
Composer is a package manager for PHP, if you ever used Linux you may be familiar with applications like apt or yum that are used to install all kinds of software. Composer does the very same thing with PHP libraries, you tell it which ones you want, and it downloads them for you. Getting composer is easy, let’s assume we want to install it into our /home/fairy/projects/ folder, we just need to run this:

cd /home/fairy/projects/
php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"

After the script executes you should have a composer.phar file in that directory.

Setting up the skeleton project
PHPixie tries to be as flexible as possible, you can dow whatever you want with the API that it provides, but the most standard site would follow a common skeleton architecture. After you have composer.phar in /home/fairy/projects/ you can just run the following:

cd /home/fairy/projects
php composer.phar create-project phpixie/project tutorial 2.*-dev --prefer-dist
cd tutorial

#If you are on Linux
php ../composer.phar update -o

#If you are on Windows
php ..\composer.phar update -o

These commands will download the skeleton project together with all its dependencies and optimize your autoloader.

Alternative: Setting up the skeleton project manually

You can get the skeleton application here: https://github.com/dracony/PHPixie . Download is a Zip Archive and extract to /home/fairy/projects/tutorial.

Now we need to get all of the PHPixie libraries. This is where Composer comes in, we will use it to download everything that our project needs. In the composer.json file you will see a list of required dependencies like this:

{
"require": {
        "phpixie/core": "2.*@dev",
        "phpixie/db": "2.*@dev",
        "phpixie/orm": "2.*@dev"
    }	
}

This requests PHPixie core and database libraries, if you ever need to add a PHPixie module, or any PHP library to your project you can use that file to request it. Now run this to install dependencies:

cd /home/fairy/projects/tutorial
php ../composer.phar install -o --prefer-dist

When the script finishes you should have all required libraries installed in your vendor folder. If you ever want to update them to the latest version just run:

cd /home/fairy/projects/tutorial
php ../composer.phar update -o --prefer-dist

Now all that is left to do is configure your Apache to point it to the /home/fairy/projects/tutorial/web/ folder, be careful and don’t miss out the /web part of the path. You should see a greeting from PHPixie, so you are on the right track.

16 thoughts on “Download Instructions

  1. IonTichy

    “Take a quick look at it, and you’ll notice that the /vendor folder is empty..”

    umm, I took a look at it and there is no such thing as a /vendor folder…

    please update this tutorial or correct it!

    Reply
    1. admin Post author

      Ah, it doesn’t matter. It will get created as soons as you run composer. I’ll update the tutorial to reflect this. Thanks

      Reply
      1. IonTichy

        yeah, I kinda realized that when building with composer, sorry bout that.
        but thanks for updating, it is a little bit confusing…

        now all works ;)

        Reply
  2. bernard

    Is there a link where you can download the entire package + ALL the modules instead of using composer? Great work by the way.

    Reply
  3. ian

    I didn’t get a welcome page I got a ‘No route matched your request error’
    Screenshot: http://i.imgur.com/WKttmvr.png

    And that was only when I added the index.php to the url.

    I tried setting the MAMP apache base directory to the ‘web’ folder but no luck.

    All the install instructions with Composer went fine.

    Reply
  4. Shiju S S

    Getting the following error:

    Class App\Controller\Web doesn’t exist
    D:\xampp\htdocs\pixie\vendor\phpixie\core\classes\PHPixie\Pixie.php

    94 */

    95 public function controller($class) {

    96 if (!class_exists($class))

    97 throw new \PHPixie\Exception\PageNotFound(“Class {$class} doesn’t exist”);

    98

    99 return new $class($this);

    D:\xampp\htdocs\pixie\vendor\phpixie\core\classes\PHPixie\Request.php

    181 {

    182 $this->pixie->cookie->set_cookie_data($this->_cookie);

    183 $class = $this->param(‘namespace’,$this->pixie->app_namespace).’Controller\\’.ucfirst($this->param(‘controller’));

    184 $controller = $this->pixie->controller($class);

    185 $controller->request = $this;

    186 $controller->run($this->param(‘action’));

    D:\xampp\htdocs\pixie\vendor\phpixie\core\classes\PHPixie\Pixie.php

    229 try {

    230

    231 $request = $this->http_request();

    232 $response = $request->execute();

    233 $response->send_headers()->send_body();

    234

    D:\xampp\htdocs\pixie\web\index.php

    3 $loader = require $root.’/vendor/autoload.php’;

    4 $loader->add(”, $root.’/classes/’);

    5 $pixie = new \App\Pixie();

    6 $pixie->bootstrap($root)->handle_http_request();

    7 ?>

    Reply
  5. Rich7

    Installed composer to test some frame works. Installing laravel worked with the quickstart, but when I paste your example in my windows cmd frame it gives errors. Shouldn’t a composer command line look like
    > composer create-project xxx/yyyy –prefer-dist

    ?

    Reply
  6. rizki

    I’m trying to install using command prompt (win) and via shell (xampp), still got bounce whenever I try go to /web path, it throw me back to localhost page (which xampp page / localhost/xampp), still I don’t know what happen. And if I try to use force to visit the web/index.php it show me “No route matched your request” message, so basically this not show me any *greeting*

    Reply
    1. admin Post author

      You don’t need to go the /web in your browser. You should configure xampp so that your root folder is the /web/ folder on disk.

      Reply

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>