Skip to content

Commit

Permalink
Fix for #7. Added PHP 8 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
takielias committed Jan 3, 2024
1 parent 959e1d6 commit 8bd3d30
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 17 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To get a local copy up and running follow these simple example steps.
### Prerequisites

- PHP 7.2+
- CodeIgniter Framework (4.* recommanded)
- CodeIgniter Framework (4.* recommended)
- Composer
- PHP sockets extension enabled

Expand Down Expand Up @@ -80,6 +80,11 @@ PHP spark serve --port=9092
```sh
php public/index.php Websocket start
```
**N.B** : Don't forget to add the following line in app/Config/Routes.php `app/Config/Routes.php`

```php
$routes->setAutoRoute(true);
```

**WOW You made it !!!** :heavy_check_mark:

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"codeigniter",
"codeigniter4",
"php7",
"php8",
"php-library",
"codeigniter websocket",
"websocket",
Expand All @@ -22,9 +23,9 @@
}
],
"require": {
"php": "^7.2",
"cboden/ratchet": "^0.4.1",
"textalk/websocket": "^1.2"
"php": "^7.2|^8.0",
"cboden/ratchet": "^0.4.4",
"textalk/websocket": "^1.6.3"
},
"require-dev": {
"codeigniter4/framework": "dev-master"
Expand Down
5 changes: 3 additions & 2 deletions src/Commands/Publish.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Commands;
<?php

namespace Takielias\CodeigniterWebsocket\Commands;

use Config\Autoload;
use CodeIgniter\CLI\CLI;
Expand All @@ -13,7 +15,6 @@
*
* CodeIgniter WebSocket library. It allows you to make powerful realtime applications by using Ratchet Websocket
*/

class Publish extends BaseCommand
{
/**
Expand Down
4 changes: 3 additions & 1 deletion src/Config/CodeigniterWebsocket.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Config;
<?php

namespace Takielias\CodeigniterWebsocket\Config;

use CodeIgniter\Config\BaseConfig;

Expand Down
5 changes: 3 additions & 2 deletions src/Config/Services.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Config;
<?php

namespace Takielias\CodeigniterWebsocket\Config;

use CodeIgniter\Config\BaseService;
use CodeIgniter\Config\BaseConfig;
Expand All @@ -12,7 +14,6 @@
*
* CodeIgniter WebSocket library. It allows you to make powerful realtime applications by using Ratchet Websocket
*/

class Services extends BaseService
{
public static function CodeigniterWebsocket(BaseConfig $config = null, bool $getShared = true)
Expand Down
4 changes: 3 additions & 1 deletion src/Controllers/Websocket.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Controllers;
<?php

namespace Takielias\CodeigniterWebsocket\Controllers;

use CodeIgniter\Controller;

Expand Down
5 changes: 3 additions & 2 deletions src/Exceptions/CodeigniterWebsocketException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Exceptions;
<?php

namespace Takielias\CodeigniterWebsocket\Exceptions;

use CodeIgniter\Exceptions\ExceptionInterface;
use CodeIgniter\Exceptions\FrameworkException;
Expand All @@ -12,7 +14,6 @@
*
* CodeIgniter WebSocket library. It allows you to make powerful realtime applications by using Ratchet Websocket
*/

class CodeigniterWebsocketException extends FrameworkException implements ExceptionInterface
{
public static function forMissingName()
Expand Down
5 changes: 3 additions & 2 deletions src/Libraries/Authorization.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Libraries;
<?php

namespace Takielias\CodeigniterWebsocket\Libraries;

use Takielias\CodeigniterWebsocket\Libraries\JWT;

Expand All @@ -11,7 +13,6 @@
*
* CodeIgniter WebSocket library. It allows you to make powerful realtime applications by using Ratchet Websocket
*/

class Authorization
{
public static function validateTimestamp($token)
Expand Down
4 changes: 3 additions & 1 deletion src/Libraries/CodeigniterWebsocket.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Libraries;
<?php

namespace Takielias\CodeigniterWebsocket\Libraries;

use CodeIgniter\Config\BaseConfig;
use Ratchet\Http\HttpServer;
Expand Down
4 changes: 3 additions & 1 deletion src/Libraries/JWT.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Libraries;
<?php

namespace Takielias\CodeigniterWebsocket\Libraries;

/**
* JSON Web Token implementation, based on this spec:
Expand Down
4 changes: 3 additions & 1 deletion src/Libraries/Server.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Takielias\CodeigniterWebsocket\Libraries;
<?php

namespace Takielias\CodeigniterWebsocket\Libraries;

use CodeIgniter\Config\BaseConfig;
use Ratchet\ConnectionInterface;
Expand Down

0 comments on commit 8bd3d30

Please sign in to comment.