PHP code example of pstaender / silverstripe-serve
1. Go to this page and download the library: Download pstaender/silverstripe-serve library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pstaender / silverstripe-serve example snippets
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();
$factory = new ServerFactory(realpath(__DIR__ . '/../'));
sh
$ vendor/bin/serve --bootstrap-file tests/serve-bootstrap.php