Skip to content

Commit

Permalink
Merge pull request #1 from hyperia-sk/rebranding
Browse files Browse the repository at this point in the history
Fix path for yii autoloader + change namespaces
  • Loading branch information
jurajkalafut authored Apr 7, 2022
2 parents bf3a2c9 + 807ba27 commit 6278fbe
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 55 deletions.
14 changes: 7 additions & 7 deletions Broadcast.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?php

namespace yiicod\socketio;
namespace hyperia\socketio;

use Exception;
use Yii;
use yii\helpers\ArrayHelper;
use yii\helpers\HtmlPurifier;
use yii\helpers\Json;
use yiicod\base\helpers\LoggerMessage;
use yiicod\socketio\drivers\RedisDriver;
use yiicod\socketio\events\EventPolicyInterface;
use yiicod\socketio\events\EventPubInterface;
use yiicod\socketio\events\EventRoomInterface;
use yiicod\socketio\events\EventSubInterface;
use hyperia\socketio\drivers\RedisDriver;
use hyperia\socketio\events\EventPolicyInterface;
use hyperia\socketio\events\EventPubInterface;
use hyperia\socketio\events\EventRoomInterface;
use hyperia\socketio\events\EventSubInterface;

/**
* Class Broadcast
*
* @package yiicod\socketio
* @package hyperia\socketio
*/
class Broadcast
{
Expand Down
2 changes: 1 addition & 1 deletion EventManager.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace yiicod\socketio;
namespace hyperia\socketio;

use Yii;
use yii\base\Component;
Expand Down
4 changes: 2 additions & 2 deletions Process.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace yiicod\socketio;
namespace hyperia\socketio;

use Yii;
use yii\helpers\HtmlPurifier;
Expand All @@ -14,7 +14,7 @@
/**
* Class Process
*
* @package yiicod\socketio
* @package hyperia\socketio
*/
class Process
{
Expand Down
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Socket.io Yii extension

Use all power of socket.io in your Yii 2 project.

[![Latest Stable Version](https://poser.pugx.org/yiicod/yii2-socketio/v/stable)](https://packagist.org/packages/yiicod/yii2-socketio) [![Total Downloads](https://poser.pugx.org/yiicod/yii2-socketio/downloads)](https://packagist.org/packages/yiicod/yii2-socketio) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiicod/yii2-socketio/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiicod/yii2-socketio/?branch=master)[![Code Climate](https://codeclimate.com/github/yiicod/yii2-socketio/badges/gpa.svg)](https://codeclimate.com/github/yiicod/yii2-socketio)

Config
------

Expand All @@ -13,15 +11,15 @@ Config
cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
cd vendor/yiicod/yii2-soketio/server
cd vendor/hyperia/yii2-soketio/server
npm install
```

#### Console config (simple fork)
```php
'controllerMap' => [
'socketio' => [
'class' => \yiicod\socketio\commands\SocketIoCommand::class,
'class' => \hyperia\socketio\commands\SocketIoCommand::class,
'server' => 'localhost:1367'
],
]
Expand All @@ -38,7 +36,7 @@ Config
```php
'controllerMap' => [
'socketio' => [
'class' => \yiicod\socketio\commands\WorkerCommand::class,
'class' => \hyperia\socketio\commands\WorkerCommand::class,
'server' => 'localhost:1367'
],
]
Expand Down Expand Up @@ -92,15 +90,15 @@ pm2 start daemons-app.json
```php
'components' =>[
'broadcastEvents' => [
'class' => \yiicod\socketio\EventManager::class,
'class' => \hyperia\socketio\EventManager::class,
'nsp' => 'some_unique_key',
// Namespaces with events folders
'namespaces' => [
'app\socketio',
]
],
'broadcastDriver' => [
'class' => \yiicod\socketio\drivers\RedisDriver::class,
'class' => \hyperia\socketio\drivers\RedisDriver::class,
'hostname' => 'localhost',
'port' => 6379,
],
Expand All @@ -109,8 +107,8 @@ pm2 start daemons-app.json

##### Create publisher from server to client
```php
use yiicod\socketio\events\EventInterface;
use yiicod\socketio\events\EventPubInterface;
use hyperia\socketio\events\EventInterface;
use hyperia\socketio\events\EventPubInterface;

class CountEvent implements EventInterface, EventPubInterface
{
Expand Down Expand Up @@ -149,14 +147,14 @@ pm2 start daemons-app.json
```
```php
//Run broadcast to client
\yiicod\socketio\Broadcast::emit(CountEvent::name(), ['count' => 10])
\hyperia\socketio\Broadcast::emit(CountEvent::name(), ['count' => 10])

```

##### Create receiver from client to server
```php
use yiicod\socketio\events\EventInterface;
use yiicod\socketio\events\EventSubInterface;
use hyperia\socketio\events\EventInterface;
use hyperia\socketio\events\EventSubInterface;

class MarkAsReadEvent implements EventInterface, EventSubInterface
{
Expand Down Expand Up @@ -202,9 +200,9 @@ You can have publisher and receiver in one event. If you need check data from cl

##### Receiver with checking from client to server
```php
use yiicod\socketio\events\EventSubInterface;
use yiicod\socketio\events\EventInterface;
use yiicod\socketio\events\EventPolicyInterface;
use hyperia\socketio\events\EventSubInterface;
use hyperia\socketio\events\EventInterface;
use hyperia\socketio\events\EventPolicyInterface;

class MarkAsReadEvent implements EventInterface, EventSubInterface, EventPolicyInterface
{
Expand Down Expand Up @@ -247,9 +245,9 @@ You can have publisher and receiver in one event. If you need check data from cl
Soket.io has room functionl. If you need it, you should implement:
- EventRoomInterface
```php
use yiicod\socketio\events\EventPubInterface;
use yiicod\socketio\events\EventInterface;
use yiicod\socketio\events\EventRoomInterface;
use hyperia\socketio\events\EventPubInterface;
use hyperia\socketio\events\EventInterface;
use hyperia\socketio\events\EventRoomInterface;

class CountEvent implements EventInterface, EventPubInterface, EventRoomInterface
{
Expand Down Expand Up @@ -310,6 +308,6 @@ Soket.io has room functionl. If you need it, you should implement:
```
```php
//Run broadcast to user id = 10
\yiicod\socketio\Broadcast::emit(CountEvent::name(), ['count' => 10, 'userId' => 10])
\hyperia\socketio\Broadcast::emit(CountEvent::name(), ['count' => 10, 'userId' => 10])

```
4 changes: 2 additions & 2 deletions SocketIoAsset.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace yiicod\socketio;
namespace hyperia\socketio;

use yii\web\AssetBundle;

Expand All @@ -14,7 +14,7 @@ class SocketIoAsset extends AssetBundle
/**
* @var string
*/
public $sourcePath = '@vendor/yiicod/yii2-socketio/server/node_modules/socket.io-client/dist';
public $sourcePath = '@vendor/hyperia/yii2-socketio/server/node_modules/socket.io-client/dist';

/**
* @var array
Expand Down
4 changes: 2 additions & 2 deletions commands/CommandTrait.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace yiicod\socketio\commands;
namespace hyperia\socketio\commands;

use Symfony\Component\Process\Process;
use Yii;
use yii\helpers\ArrayHelper;
use yii\helpers\Console;
use yii\helpers\Json;
use yiicod\socketio\Broadcast;
use hyperia\socketio\Broadcast;

trait CommandTrait
{
Expand Down
8 changes: 4 additions & 4 deletions commands/SocketIoCommand.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace yiicod\socketio\commands;
namespace hyperia\socketio\commands;

use Symfony\Component\Process\Process;
use yiicod\cron\commands\DaemonController;
use yiicod\socketio\Broadcast;
use hyperia\cron\commands\DaemonController;
use hyperia\socketio\Broadcast;

/**
* Class SocketIoCommand
* Run this daemon for listen socketio. Don't forget about run npm install in the folder "server".
*
* @package yiicod\socketio\commands
* @package hyperia\socketio\commands
*/
class SocketIoCommand extends DaemonController
{
Expand Down
8 changes: 4 additions & 4 deletions commands/WorkerCommand.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

//namespace yiicod\socketio\commands;
//namespace hyperia\socketio\commands;
//
//use yii\console\Controller;
//
///**
// * Class SocketIoCommand
// * Run this daemon for listen socketio. Don't forget about run npm install in the folder "server".
// *
// * @package yiicod\socketio\commands
// * @package hyperia\socketio\commands
// */
//class WorkerCommand extends Controller
//{
Expand Down Expand Up @@ -54,14 +54,14 @@
// }
//}

namespace yiicod\socketio\commands;
namespace hyperia\socketio\commands;

use yii\console\Controller;

/**
* Socketio server. You should run two commands: "socketio/node-js-server" and "socketio/php-server". Use pm2 as daemon manager.
*
* @package yiicod\socketio\commands
* @package hyperia\socketio\commands
*/
class WorkerCommand extends Controller
{
Expand Down
6 changes: 3 additions & 3 deletions composer.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "yiicod/yii2-socketio",
"name": "hyperia/yii2-socketio",
"description": "The simple and powerful socketio for the Yii2 framework",
"type": "yii2-extension",
"license": "MIT",
Expand All @@ -12,7 +12,7 @@
],
"require": {
"yiisoft/yii2": "2.*",
"yiicod/yii2-cron": "1.*",
"hyperia/yii2-cron": "1.*",
"yiicod/yii2-base": "1.*",
"symfony/process": "~3.0|~4.0",
"predis/predis": "~1.1.0"
Expand All @@ -28,7 +28,7 @@
],
"autoload": {
"psr-4": {
"yiicod\\socketio\\": "/"
"hyperia\\socketio\\": ""
}
}
}
4 changes: 2 additions & 2 deletions drivers/RedisDriver.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace yiicod\socketio\drivers;
namespace hyperia\socketio\drivers;

use yii\helpers\ArrayHelper;

Expand All @@ -9,7 +9,7 @@
*
* Class RedisDriver
*
* @package yiicod\socketio\drivers
* @package hyperia\socketio\drivers
*/
class RedisDriver
{
Expand Down
4 changes: 2 additions & 2 deletions events/EventInterface.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace yiicod\socketio\events;
namespace hyperia\socketio\events;

/**
* Interface EventInterface
* Event name and broadcast nsp
*
* @package yiicod\socketio\events
* @package hyperia\socketio\events
*/
interface EventInterface
{
Expand Down
2 changes: 1 addition & 1 deletion events/EventPolicyInterface.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace yiicod\socketio\events;
namespace hyperia\socketio\events;

interface EventPolicyInterface
{
Expand Down
4 changes: 2 additions & 2 deletions events/EventPubInterface.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace yiicod\socketio\events;
namespace hyperia\socketio\events;

/**
* Interface EventPubInterface
* Event publish interface
*
* @package yiicod\socketio\events
* @package hyperia\socketio\events
*/
interface EventPubInterface
{
Expand Down
4 changes: 2 additions & 2 deletions events/EventRoomInterface.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace yiicod\socketio\events;
namespace hyperia\socketio\events;

/**
* Interface EventRoomInterface
* Provide room support for event
*
* @package yiicod\socketio\events
* @package hyperia\socketio\events
*/
interface EventRoomInterface
{
Expand Down
4 changes: 2 additions & 2 deletions events/EventSubInterface.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace yiicod\socketio\events;
namespace hyperia\socketio\events;

/**
* Interface EventSubInterface
* Event subscriber interface
*
* @package yiicod\socketio\events
* @package hyperia\socketio\events
*/
interface EventSubInterface
{
Expand Down
Empty file modified server/.gitignore
100644 → 100755
Empty file.
Empty file modified server/bundles/access-io.js
100644 → 100755
Empty file.
Empty file modified server/bundles/args.js
100644 → 100755
Empty file.
Empty file modified server/bundles/logger.js
100644 → 100755
Empty file.
Empty file modified server/bundles/redis-io.js
100644 → 100755
Empty file.
Empty file modified server/bundles/room-io.js
100644 → 100755
Empty file.
Empty file modified server/bundles/server.js
100644 → 100755
Empty file.
Empty file modified server/index.js
100644 → 100755
Empty file.
Empty file modified server/package.json
100644 → 100755
Empty file.

0 comments on commit 6278fbe

Please sign in to comment.