Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrieljmj/silexserver
Easily create web servers for your Silex web application
https://github.com/gabrieljmj/silexserver
Last synced: about 2 months ago
JSON representation
Easily create web servers for your Silex web application
- Host: GitHub
- URL: https://github.com/gabrieljmj/silexserver
- Owner: gabrieljmj
- License: other
- Created: 2015-06-14T17:36:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-14T18:09:47.000Z (over 9 years ago)
- Last Synced: 2024-11-13T17:40:45.492Z (2 months ago)
- Language: PHP
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
SilexServer
===========
[![Build Status](https://travis-ci.org/GabrielJMJ/SilexServer.svg?branch=master)](https://travis-ci.org/GabrielJMJ/SilexServer) [![License](https://img.shields.io/packagist/l/gabrieljmj/silex-server.svg)](https://packagist.org/packages/gabrieljmj/silex-server) [![Total Downloads](https://img.shields.io/packagist/dt/gabrieljmj/silex-server.svg)](https://packagist.org/packages/gabrieljmj/silex-server) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/gabrieljmj/silexserver.svg)](https://scrutinizer-ci.com/g/GabrielJMJ/SilexServer/?branch=dev)Easily create web servers for your Silex web application.
## Installation
Via [Composer](https://getcomposer.org):
```console
composer require gabrieljmj/silex-server
```## Usage
Create your Silex application normaly:
```php
# index.php
get('/hello/{name}', function ($name) use ($app) {
return 'Hello '.$app->escape($name);
});$app->run();
return $app; // This MUST be in the file
```And now create the bin that will create the server:
```php
#!/usr/bin/env php
createServer($host, $port, function () use ($port) {
echo "Running on port {$port}\n";
})->run();
```Build the server:
```console
your-bin
```
Now you can access ```http://localhost:3000```.