PHPackages                             smrtr/spawn-point - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. smrtr/spawn-point

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

smrtr/spawn-point
=================

A featherweight dispatch process enabling rapid development.

1.2.0(10y ago)088MITPHP

Since Feb 13Pushed 10y ago3 watchersCompare

[ Source](https://github.com/smrtr/spawn-point)[ Packagist](https://packagist.org/packages/smrtr/spawn-point)[ RSS](/packages/smrtr-spawn-point/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (5)Versions (7)Used By (0)

spawn-point
===========

[](#spawn-point)

A quick and dirty dispatch process using Haltorouter.

This featherweight stack uses [Symfony's HttpFoundation](http://symfony.com/doc/current/components/http_foundation/introduction.html) Request &amp; Response objects with [Smrtr's Haltorouter](http://resources.smrtr.co.uk/haltorouter)object to enable you to start developing extremely quickly.

Installation
------------

[](#installation)

From your project root:

1. Require spawn-point with composer. Add `"smrtr/spawn-point": "~1.0"` to the `require` section of your `composer.json`.
2. Run `composer update` to download the spawn-point library.
3. Run `vendor/bin/spawn spawn` to create the required project files.

Configuration
-------------

[](#configuration)

### vHost

[](#vhost)

Apache2 vhost configuration must declare the rewrite engine to be on and the document root to be inside a directory called `public` inside your project root. See the following vhost for a project called Buzz located in `/var/www/Buzz`:

```
# Buzz

    ServerName buzz.local
    ServerAlias www.buzz.local
    ServerAlias private.buzz.local
    DocumentRoot "/var/www/Buzz/public"
    RewriteEngine on
    SetEnv APP_ENV "development"

        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Satisfy Any
        Allow from all
        Require all granted

```

### Hostgroups

[](#hostgroups)

Use `app/config/hostgroups.ini` to organize hostnames into groups. These hostgroups are used to match requests. See the following hostgroup configuration for example which creates two groups, 'Public' and 'Private':

```
[development]
Public[] = "buzz.local"
Public[] = "www.buzz.local"
Private[] = "private.buzz.local"

```

### Routes

[](#routes)

Use `app/config/routes.ini` to define your routes. These routes will be passed into a `Smrtr\Haltorouter` instance. Routes can be grouped by environment if you wish. See the following example which defines a route to the homepage across the development &amp; production environments:

```
[bootstrap]
homepage.route = "/"
homepage.method = "GET"
homepage.hostgroup = "Public"
homepage.target = "\Buzz\HomepageController@homepage"

[development : bootstrap]

[production : bootstrap]

```

The 'target' of the route tells the application which class to load and which method to call.

### PHP settings

[](#php-settings)

You may specify php settings, much like you would in php.ini, in `app/config/phpSettings.ini`. This is a convenient way to define php settings at runtime without depending on the php settings of the environment.

Usage
-----

[](#usage)

To complete our example we need to implement the homepage controller which we defined in our routes config.

In `src\Buzz\HomepageController.php`:

```
