Getting started

"A journey of a thousand miles begins with a single step" - Laozi

OK, so we know what Li3 is and what we're going to build with it! Roughly. Well, we know what we want to get out of it, anyway.

I guess to get started we'd better get Li3 installed... Before that, though, make sure you have PHP installed and a web server - I generally use Nginx but Li3 has instructions for plenty of servers.

I won't duplicate the Li3 docs here - see the requirements page for Li3 and the Li3 installation guide to get up and running.

We'll start with the sample app and go from there! Check out Union of Rad's Framework from Github and set it up as per the Li3 docs. What you want to get to is seeing this screen:

Default Li3 framework screen

Here's how I did it

This section is just how I set it up. This is not "documentation", this is just what I did, it's better to read li3.me/docs/manual and follow their guide, but I'm including my gubbins for reference.

Open a terminal and run:

cd /var/www
git clone https://github.com/UnionOfRAD/framework.git employee-rolodex
cd employee-rolodex

We can haz a checkout! Now let's set up a hosts file entry for development so that requests to "employee-rolodex.localhost" get routed back to your computron on local address 127.0.0.1. You don't have to do it this way - PHP has a built in web server etc but here's what works for me!

sudo sh -c 'echo "127.0.0.1 employee-rolodex.localhost" >> /etc/hosts'

Right, next job - set up a web server to listen for requests to employee-rolodex.localhost - here's my config:

cd /etc/nginx/sites-enabled
sudo vim employee-rolodex.localhost

Now your mileage REALLY may vary here, so follow the docs rather than me, but what worked for me is:

server {
        server_name employee-rolodex.localhost;
        root /var/www/employee-rolodex/app/webroot;

        index index.php;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        include global/restrictions.conf;
        # Pass all .php files onto a php-fpm/php-fcgi server.
        location ~ \.php$ {
            try_files $uri =404;

            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            include fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass php;
        }
}

The file global/restrictions.conf is something I "borrowed" from the Wordpress Nginx setup page!

Then I restarted nginx:

sudo /etc/init.d/nginx restart

(Again, I'm on Ubuntu, so your specific instructions may vary)

OK now if you browse to http://employee-rolodex.localhost/ - well, initially Chrome will probably try to search for that, but if you glare at it for a bit and make sure to include the http:// at the start and / at the end, it generally gets the message eventually! You should have a lovely encouraging error message now. It means that Li3 hasn't been installed. The "framework" repo includes Li3 as a submodule, so run:

cd /var/www/employee-rolodex
git submodule init && git submodule update

Now, if you browse to http://employee-rolodex.localhost/ you should see a nice screen!

Default Li3 framework screen

OK that's pretty sweet right now, we have a page up! Let's do some coding!