2017 © Pedro PelĂĄez
 

library serve

Connects the PHP development server to SilverStripe

image

silverstripe/serve

Connects the PHP development server to SilverStripe

  • Tuesday, July 24, 2018
  • by assertchris
  • Repository
  • 6 Watchers
  • 16 Stars
  • 43,249 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 6 Forks
  • 5 Open issues
  • 12 Versions
  • 19 % Grown

The README.md

SilverStripe Serve

A simple dev task, to start a development server for your SilverStripe app., (*1)

Getting started

$ composer require silverstripe/serve
$ framework/sake dev/build flush=1
$ vendor/bin/serve

This will start the server at http://localhost:8080., (*2)

You can override the host/port:, (*3)

$ vendor/bin/serve --host 127.0.0.1 --port 8000

, (*4)

Including a bootstrap file

The bootstrap-file argument lets you include a custom PHP file after composer has been loaded (which includes Silverstripe’s Constants.php) but before main.php has been loaded., (*5)

This can be used for any number of things, but the primary use-case is to pull in any stub code & config that wouldn’t normally be included by SilverStripe in the current execution session, such as test stubs., (*6)

$ vendor/bin/serve --bootstrap-file tests/serve-bootstrap.php

Using as a library

You can also use serve as a library, to start a SilverStripe server from some other tool such as a test suite:, (*7)

Assuming that BASE_PATH is defined, you can use it like this:, (*8)

use SilverStripe\Serve\ServerFactory;

$factory = new ServerFactory();

$server = $factory->launchServer([
    'host' => 'localhost',
    'preferredPort' => 3000,
]);

// Print the contents of the homepage
echo file_get_contents($server->getURL());

// Stop the server when you're done with it
$server->stop();

If BASE_PATH is not defined, e.g. if you are not running a SapphireTest, you can provide an alternative path to the factory constructor:, (*9)

$factory = new ServerFactory(realpath(__DIR__ . '/../'));

launchServer allows the following options to be passed to it:, (*10)

  • host: The host to listen on, defaulting to 0.0.0.0
  • preferredPort: The preferred port. If this port isn't available, the next highest one will be used
  • bootstrapFile: The bootstrap file, as described above

The Versions

24/07 2018

2.x-dev

2.9999999.9999999.9999999-dev

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

14/02 2018

dev-master

9999999-dev

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

15/01 2018

2.1.1

2.1.1.0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

12/01 2018

2.1.0

2.1.0.0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

28/11 2017

2.0.x-dev

2.0.9999999.9999999-dev

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

24/10 2017

2.0.1

2.0.1.0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

10/10 2017

2.0.0

2.0.0.0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

09/10 2017

1.x-dev

1.9999999.9999999.9999999-dev

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

09/10 2017

1.0.1

1.0.1.0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

08/02 2017

dev-pre-release-2-0

dev-pre-release-2-0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

16/09 2016

dev-ss3-fix

dev-ss3-fix

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires

 

20/05 2016

1.0.0

1.0.0.0

Connects the PHP development server to SilverStripe

  Sources   Download

MIT

The Requires