This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

Overview

Kraken Demo Application - Chat

Total Downloads Latest Stable Version Latest Unstable Version License Gitter @kraken_php on Twitter

Note: This repository contains pre-configured distributed chat application based on Kraken Framework.


Description

This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

Architecture

Screenshots

Requirements

  • PHP-5.5, PHP-5.6 or PHP-7.0+,
  • Pthreads extension enabled (only if you want to use threading),
  • UNIX or Windows OS.

Installation and Official Documentation

To install this application skeleton, please go to desired location to store project, then call composer:

composer create-project --prefer-dist kraken-php/demo-chat .

Documentation for the framework can be found in the official documentation page.

Starting Project

Basic Start

To start project, first run kraken.server instance.

$> php kraken.server

Then, check if connection is working in another terminal window:

$> php kraken server:ping

If everything works correctly, as final step run the application using:

$> php kraken project:create

After project has been created successfully, go to http://localhost:6080 address in your browser and you should be able to see and use examplary chat.

To close whole project, use:

$> php kraken project:destroy

If you have problems with configuring console-server connection, you can also try alternative start.

Alternative Start

To start project directly, without console support, use:

$> php ./data/autorun/kraken.process undefined HttpBroker HttpBroker

WARNING This method will be deprecated in upcoming ver 0.4.

Contributing

This library is pre-configured project application for Kraken Framework. To make contributions, please go to framework repository.

License

Kraken Framework is open-sourced software licensed under the MIT license. The documentation is provided under FDL-1.3 license.

Comments
  • 404 for all routes

    404 for all routes

    I managed to start it finally, but for all routes I have 404 error. Don't know why.

    PHP 7.2.0-dev (cli) (built: Oct 10 2016 16:22:13) ( ZTS DEBUG ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

    My changes was only replacing in SocketListener ip address, I made it listed external ipaddress.

    Kraken 0.3.1 by Kamil Jamroz and contributors. Executing : project:create ... success! Response : Project has been created.

    opened by tpoxa 10
  • php kraken throws an exception

    php kraken throws an exception

    hi when i try php kraken.server it throws php kraken.server

    Server is booting...
            Throwable trace:
             0. [InstantiationException] "stream_socket_pair() could not establish c
    onnection." in Isolate:29
             1. [ExecutionException] "ServiceProvider [Kraken\Root\Provider\SystemPr
    ovider] raised an error." in ServiceProvider:157
             2. [ExecutionException] "ServiceProvider Kraken\Root\Provider\SystemPro
    vider failed during registration." in ServiceRegister:352
             3. [ExecutionException] "ServiceRegister could not be booted." in Servi
    ceRegister:92
             4. [InstantiationException] "Core module could not be booted." in Core:
    79
            Stack trace:
             0. [throwable] Kraken\Throwable\Exception\Logic\InstantiationException(
    ...) in Isolate:29
             1. [call] Kraken\Util\Isolate\Isolate->__construct() in SystemProvider:
    26
             2. [throwable] Kraken\Throwable\Exception\Runtime\ExecutionException(..
    .) in ServiceProvider:157
             3. [call] Kraken\Container\ServiceProvider->throwException(Kraken\Throw
    able\Exception\Logic\InstantiationException) in ServiceProvider:84
             4. [call] Kraken\Container\ServiceProvider->registerProvider(Kraken\Roo
    t\Console\Server\Core\ServerCore) in ServiceRegister:342
             5. [throwable] Kraken\Throwable\Exception\Runtime\ExecutionException(..
    .) in ServiceRegister:352
             6. [call] Kraken\Container\ServiceRegister->registerProviders() in Serv
    iceRegister:80
             7. [throwable] Kraken\Throwable\Exception\Runtime\ExecutionException(..
    .) in ServiceRegister:92
             8. [call] Kraken\Container\ServiceRegister->boot() in Core:331
             9. [call] Kraken\Core\Core->bootProviders() in Core:70
            10. [throwable] Kraken\Throwable\Exception\Logic\InstantiationException(
    ...) in Core:79
            11. [call] Kraken\Core\Core->boot() in ServerBoot:125
            12. [call] Kraken\Root\Console\Server\Boot\ServerBoot->boot("E:\htdocs\k
    raken-php/data") in kraken.server:29
            13. [main]
    
    opened by moeinrahimi 1
  • php kraken.server throws an exception

    php kraken.server throws an exception

    When I try to run the chat demo .. I get the following error:

    MacOS 10.11 → php -v PHP 5.6.7 (cli) (built: Mar 23 2015 01:51:22) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

    **php kraken.server**
    Server is booting...
    PHP Warning:  Uncaught  Throwable trace:
         0. [WarningError] "require(): data:/ wrapper is disabled in the server configuration by allow_url_include=0" in /ConfigFactory.php:48
        Stack trace:
         0. [throwable] Kraken\Throwable\Error\WarningError(...) in ErrorHandler:63
         1. [call] Kraken\Throwable\ErrorHandler::handleError(2, "require(): data:// wrapper is di...", "/Users/ashammari/github/demo-cha...", 48, Array) in ConfigFactory:48
         2. [call] Kraken\Config\ConfigFactory::Kraken\Config\{closure}() in ConfigFactory:48
         3. [call] Kraken\Config\ConfigFactory->Kraken\Config\{closure}() in unknown:0
         4. [call] Undefinedcall_user_func_array(Closure, Array) in SimpleFactoryTrait:128
         5. [call] Kraken\Util\Factory\SimpleFactory->create() in ConfigProvider:180
         6. [call] Kraken\Root\Provider\ConfigProvider->createConfig("/Users/ashammari/github/demo-cha...") in ConfigProvider:239
         7. [call] Kraken\Root\Provider\ConfigProvider->configure(Kraken\Config\Config) in ConfigProvider:103
         8. [call] Kraken\Root\Provider\ConfigProvider- in /Users/ashammari/github/demo-chat/vendor/kraken-php/throwable/ErrorHandler.php on line 63
    PHP Fatal error:  Kraken\Config\ConfigFactory::Kraken\Config\{closure}(): Failed opening required 'data://text/plain;base64,PD9waHAKCi8qKgogKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICogRGVmYXVsdCBjb25maWd1cmF0aW9uIGZvciBDb25zb2xlIFNlcnZlci4KICoKICogRm9yIG1vcmUgaW5mb3JtYXRpb24gdmlzaXQ6IGh0dHA6Ly9rcmFrZW4tcGhwLmNvbS9kb2NzCiAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogKi8KcmV0dXJuIFsKICAgIC8qKgogICAgICogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICAgICAqIEFkZGl0aW9uYWwgY29uZmlndXJhdGlvbiBmaWxlIHRvIGxvYWQuCiAgICAgKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgICogVGhpcyB2YXJpYWJsZS in /Users/ashammari/github/demo-chat/vendor/kraken-php/config/ConfigFactory.php on line 48
        Throwable trace:
         0. [FatalError] "Kraken\Config\ConfigFactory::Kraken\Config\{closure}(): Failed opening required 'data:/plain;base64,PD9waHAKCi8qKgogKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICogRGVmYXVsdCBjb25maWd1cmF0aW9uIGZvciBDb25zb2xlIFNlcnZlci4KICoKICogRm9yIG1vcmUgaW5mb3JtYXRpb24gdmlzaXQ6IGh0dHA6Ly9rcmFrZW4tcGhwLmNvbS9kb2NzCiAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogKi8KcmV0dXJuIFsKICAgIC8qKgogICAgICogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICAgICAqIEFkZGl0aW9uYWwgY29uZmlndXJhdGlvbiBmaWxlIHRvIGxvYWQuCiAgICAgKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgICogVGhpcyB2YXJpYWJsZS" in /ConfigFactory.php:48
        Stack trace:
         0. [throwable] Kraken\Throwable\Error\FatalError(...) in ErrorHandler:64
         1. [call] Kraken\Throwable\ErrorHandler::handleError(64, "Kraken\Config\ConfigFactory::Kra...", "/Users/ashammari/github/demo-cha...", 48) in ErrorHandler:80
         2. [call] Kraken\Throwable\ErrorHandler::handleShutdown(1) in EnvironmentProvider:45
         3. [call] Kraken\Root\Provider\EnvironmentProvider->Kraken\Root\Provider\{closure}() in unknown:0
         4. [main]
    Killed: 9
    
    opened by abshammeri 1
  • stream_socket_pair() could not establish connection.

    stream_socket_pair() could not establish connection.

    after installing the demo application , i tried running the server using :

    php kraken.server
    

    which causes InstantiationException to be throw :

    Server is booting...
            Throwable trace:
             0. [InstantiationException] "stream_socket_pair() could not establish connection." in Isolate:29
             1. [ExecutionException] "ServiceProvider [Kraken\Root\Provider\SystemProvider] raised an error." in ServiceProvider:157
             2. [ExecutionException] "ServiceProvider Kraken\Root\Provider\SystemProvider failed during registration." in ServiceRegister:352
             3. [ExecutionException] "ServiceRegister could not be booted." in ServiceRegister:92
             4. [InstantiationException] "Core module could not be booted." in Core:79
            Stack trace:
             0. [throwable] Kraken\Throwable\Exception\Logic\InstantiationException(...) in Isolate:29
             1. [call] Kraken\Util\Isolate\Isolate->__construct() in SystemProvider:26
             2. [throwable] Kraken\Throwable\Exception\Runtime\ExecutionException(...) in ServiceProvider:157
             3. [call] Kraken\Container\ServiceProvider->throwException(Kraken\Throwable\Exception\Logic\InstantiationException) in ServiceProvider:84
             4. [call] Kraken\Container\ServiceProvider->registerProvider(Kraken\Root\Console\Server\Core\ServerCore) in ServiceRegister:342
             5. [throwable] Kraken\Throwable\Exception\Runtime\ExecutionException(...) in ServiceRegister:352
             6. [call] Kraken\Container\ServiceRegister->registerProviders() in ServiceRegister:80
             7. [throwable] Kraken\Throwable\Exception\Runtime\ExecutionException(...) in ServiceRegister:92
             8. [call] Kraken\Container\ServiceRegister->boot() in Core:331
             9. [call] Kraken\Core\Core->bootProviders() in Core:70
            10. [throwable] Kraken\Throwable\Exception\Logic\InstantiationException(...) in Core:79
            11. [call] Kraken\Core\Core->boot() in ServerBoot:125
            12. [call] Kraken\Root\Console\Server\Boot\ServerBoot->boot("C:\xampp\htdocs\pluto/data") in kraken.server:28
            13. [main]
    
    opened by azjezz 0
  • Can not ping

    Can not ping

    Env:

    [vagrant@centstead-box demo-chat]$ php -v
    PHP 7.0.13 (cli) (built: Nov  8 2016 20:16:29) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
        with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
    

    Start:

    [vagrant@centstead-box demo-chat]$ sudo php kraken.server
    Server is booting...
    Server is up!
    

    Ping:

    [vagrant@centstead-box demo-chat]$ php kraken server:ping
    Kraken 0.3.2 by Kamil Jamroz and contributors.
    
    Executing : server:ping ... failure!
    Response  : No response was received during specified timeout.
    Reason    : Kraken\Throwable\Exception\Runtime\TimeoutException
    

    Is there a way to find out why ping timeout.

    Thanks.

    opened by lichunqiang 0
  • Package guzzle/http is abandoned, you should avoid using it. Use guzzle/guzzle instead.

    Package guzzle/http is abandoned, you should avoid using it. Use guzzle/guzzle instead.

    When installing the app through composer the following deprecation warning is thrown: "Package guzzle/http is abandoned, you should avoid using it. Use guzzle/guzzle instead.".

    opened by bartvanhoutte 1
Releases(v0.3.0)
Owner
Kraken
Distributed & Async PHP Framework
Kraken
Official Kraken.io Magento Extension

Kraken.io Magento Extension Advanced optimization for your Magento JPEG, PNG, GIF and SVG images Established in 2012, Kraken.io is an industry-leading

Kraken.io Image Optimizer 21 Nov 30, 2022
Websocket chat room written in PHP based on workerman.

基于workerman的GatewayWorker框架开发的一款高性能支持分布式部署的聊天室系统。

walkor 1.1k Jan 8, 2023
HTMX example app that demonstrates how to use HTMX to add javascript interactivity to a serverside rendered PHP app

HTMX examle app This demo app demonstrates how to use HTMX to transform a server side rendered PHP app into a more 'interactive' app with AJAX request

Alexander Morland 3 Dec 11, 2022
This is a project demonstrates how to improve authoring experience Matrix Façades

About nystudio107/matrixfacades This is a project demonstrates how to improve authoring experience Matrix Façades Using nystudio107/matrixfacades Init

nystudio107 3 Aug 16, 2022
A PHP Chat based on LE CHAT

General Information: This is a PHP Chat based on LE CHAT v.1.14. An up-to-date copy of this script can be downloaded at https://github.com/DanWin/le-c

Daniel Winzen 137 Dec 17, 2022
Asynchronous WebSocket client

Pawl An asynchronous WebSocket client in PHP Install via composer: composer require ratchet/pawl Usage Pawl as a standalone app: Connect to an echo s

Ratchet 528 Dec 15, 2022
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers

Magento 2 SMTP Extension - Gmail, G Suite, Amazon SES, Office 365, Mailgun, SendGrid, Mandrill and other SMTP servers. For Magento 2.0.x, 2.1.x, 2.2.x

MagePal :: Magento Extensions 303 Oct 7, 2022
A small library to help run PHP servers easily and quickly.

PHP Server A small library to help run PHP servers easily and quickly. Installation composer require ahmard/php-server Usage PHP Built-In Server An i

Ahmad Mustapha 9 Dec 31, 2022
Simple custom chat bot developing framework for telegram, qq and more in PHP (the best language)

RinoBot RinoBot 是一个为统一聊天机器人扩展开发的框架,编写一份插件用于多种机器人协议。 简体中文 | English ?? 开发中 ?? 暂不适用于生产环境 特性 插件扩展机制 一份代码运行于多平台多协议机器人 并减小开发难度 插件提供 Yaml 配置 供使用者修改 基于机器人 We

LixWorth 3 Apr 18, 2022
API server and modernized control panel for PocketMine servers.

WebConsole API server and modernized control panel for PocketMine servers. The WebConsole plugin provides an HTTP API server that can be extended with

Jonathan Chan Kwan Yin 5 Aug 26, 2022
A framework agnostic PHP library to build chat bots

BotMan If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course. About BotMa

BotMan 5.8k Jan 1, 2023
Execute Artisan commands on remote servers

Execute Artisan commands on remote servers This package provides a command to execute Artisan command on a remote server. Here's an example that will

Spatie 238 Dec 29, 2022
Creates a WorldBorder for PocketMine-MP servers!

This plugin is not yet ready for Poggit or download It is going through mass changes over the next few days Message my Discord to recieve an older eli

Soulz 9 Sep 5, 2021
Block ads for other servers.

[] NoAdvertisings| v0.0.1 Block ads for other servers. Features Block server ads. Easy to setup. Block server address ads when chatting, using command

Nguyễn Hiếu 4 Aug 28, 2022
Custom NPC for pocket-mine servers

[Description] Click on above picture to see tutorial video of the plugin. This is an NPC plugin with super easy customization for pocket-mine. Note: W

null 10 Oct 9, 2022
A tool for managing SSH key access to any number of servers.

Revons - SSH Key Authority Features Easily manage SSH key access for all accounts on your servers. Manage user access and server-to-server access rule

Revons Community 1 Mar 14, 2022
✨A simple way to create a GUI on servers based on PocketMine-MP 4.0!✨

FakeInventories ✨ A simple way to create a GUI on servers based on PocketMine-MP 4.0! ✨ (https://youtu.be/D1NIx8E2UPg) Features Fast opening without a

iDarkQ 6 Nov 20, 2022
Cool economy plugin for PM-like servers. API included.

Economy Description Cool and easy to use economy plugin API: 2.0.0 Plugin version: 1.0.0 Default money value on first join: 1000 (can be changed in co

Artem Turov 0 Feb 4, 2022
A Customizable Fishing Rod for PocketMine-MP servers.

Custom Fishing Rod About [ENG] This is a PocketMine-MP (or forks) plugin that implements a customizable fishing rod to your server. [FRA] C'est un plu

null 6 May 25, 2022