Skip to content

parkingomat/reactphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

reactphp

app.parkingomat.com

ENV

PHP

apt install -y php

Composer

sudo apt install -y composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

npm

apt install -y npm

kill proces

npx kill-port 8080
npx kill-port 80

recommended install: pick required components

composer require react/event-loop react/http

quick protoyping only: install all stable components

composer require react/react:^1.2

web server written in ReactPHP responds with "Hello World!" for every request.

    <?php

    require __DIR__ . '/vendor/autoload.php';

    $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
        return React\Http\Message\Response::plaintext(
            "Hello World!\n"
        );
    });

    $socket = new React\Socket\SocketServer('0.0.0.0:80');
    $http->listen($socket);

    echo "Server running at http://localhost:80" . PHP_EOL;

Releases

No releases published

Packages

No packages published