daschl/li3_server

There is no license information available for the latest version (dev-master) of this package.

Booting Lithium from the CLI.

Installs: 669

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 1

Forks: 3

Open Issues: 4

Type:lithium-library

dev-master 2012-08-10 06:25 UTC

This package is not auto-updated.

Last update: 2024-05-19 00:42:04 UTC


README

This plugin utilizes the new HTTP server integrated in PHP 5.4 and allows you to start your app from the command line, without the need for a server like Apache or Nginx.

Note that this is highly experimental and while it works, a lot of tests in /test seem to fail.

Requirements

  • PHP 5.4 as it introduces the new built-in HTTP server.
  • Lithium, of course.

Installation

The easiest way to install li3_server is through Composer.

{
	"require": {
		"daschl/li3_server": "master"
	}
}

Alternatively, you can install it directly from GitHub:

$ cd libraries
$ git clone git://github.com/daschl/li3_server.git

Now you need to add it to your Lithium bootstrap file (config/bootstrap/libraries.php):

Libraries::add('li3_server');

Usage

Head to the command line and run it through li3 server.

$ li3 server
--------------------------------------------------------------------------------
Lithium Development Server
--------------------------------------------------------------------------------
Booting: php -S localhost:8000 -t /path/to/webroot
Starting on localhost:8000...

You can also override the following settings:

  • --php: The path to your PHP binary. Defaults to php.
  • --host: The hostname to which the server will listen. Defaults to localhost.
  • --port: The port on which the server will listen. Defaults to 8000.
  • --webroot: A custom webroot. Defaults to LITHIUM_APP_PATH/webroot.
  • --router: A custom router script. Defaults to the provided one at config/router.php.

If you are still running mainly PHP 5.3 and want to experiment with the server, you can do it like this:

$ li3 server --php=/home/michael/Downloads/php-5.4.0RC6/sapi/cli/php
--------------------------------------------------------------------------------
Lithium Development Server
--------------------------------------------------------------------------------
Booting: /home/michael/Downloads/php-5.4.0RC6/sapi/cli/php -S localhost:8000 -t /home/michael/web/framework/app/webroot
Starting on localhost:8000...