Skip to content

Commit fdeab54

Browse files
committed
initial commit
0 parents  commit fdeab54

21 files changed

+15003
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.eslintrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
jest: true,
6+
node: true,
7+
},
8+
parser: "@typescript-eslint/parser",
9+
plugins: ["@typescript-eslint"],
10+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
11+
rules: {
12+
"@typescript-eslint/ban-types": "off",
13+
"@typescript-eslint/no-explicit-any": "off",
14+
"prefer-const": "off",
15+
},
16+
};

.gitattributes

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto
2+
3+
/.github export-ignore
4+
/tests export-ignore
5+
.editorconfig export-ignore
6+
.gitattributes export-ignore
7+
.gitignore export-ignore
8+
.npmignore export-ignore
9+
.styleci.yml export-ignore
10+
CHANGELOG.md export-ignore

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
dist/
3+
build/
4+
npm-debug.log
5+
package-lock.json
6+
vendor/

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) George Boot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# laravel-echo-api-gateway
2+
3+
```
4+
composer require georgeboot/laravel-echo-api-gateway
5+
```
6+
7+
```
8+
yarn add georgeboot/laravel-echo-api-gateway
9+
```
10+
11+
Edit your `.env`:
12+
```dotenv
13+
MIX_BROADCAST_API_GATEWAY_URL=wss://1234567890.execute-api.your-region.amazonaws.com/stage-name
14+
MIX_BROADCAST_API_GATEWAY_URL="${BROADCAST_API_GATEWAY_URL}"
15+
```
16+
17+
Add to your javascript file:
18+
19+
20+
```js
21+
import Echo from 'laravel-echo';
22+
import LaravelEchoApiGatewayConnector from 'laravel-echo-api-gateway';
23+
24+
const echo = new Echo({
25+
broadcaster: options => new LaravelEchoApiGatewayConnector(options),
26+
host: process.env.MIX_BROADCAST_API_GATEWAY_URL,
27+
});
28+
```
29+
30+
In `handlers/websocket.php`:
31+
32+
```php
33+
<?php
34+
35+
use Georgeboot\LaravelEchoApiGateway\LaravelEchoApiGatewayHandler;
36+
use Illuminate\Foundation\Application;
37+
38+
require __DIR__ . '/../vendor/autoload.php';
39+
40+
/** @var Application $app */
41+
$app = require __DIR__ . '/../bootstrap/app.php';
42+
43+
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
44+
$kernel->bootstrap();
45+
46+
return $app->make(LaravelEchoApiGatewayHandler::class);
47+
```

composer.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "georgeboot/laravel-echo-api-gateway",
3+
"description": "Use Laravel Echo with API Gateway Websockets",
4+
"keywords": [
5+
"laravel",
6+
"echo",
7+
"websockets"
8+
],
9+
"homepage": "https://github.com/georgeboot/laravel-echo-api-gateway",
10+
"type": "library",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "George Boot",
15+
"email": "[email protected]"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.4|^8.0",
20+
"ext-json": "*",
21+
"aws/aws-sdk-php": "^3.80",
22+
"bref/bref": "^1.1",
23+
"guzzlehttp/guzzle": "^6.3|^7.0",
24+
"laravel/framework": "^6.0|^7.0|^8.0"
25+
},
26+
"require-dev": {
27+
"mockery/mockery": "^1.2",
28+
"orchestra/testbench": "^4.0|^5.0|^6.0",
29+
"phpunit/phpunit": "^8.0|^9.0"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Georgeboot\\LaravelEchoApiGateway\\": "php-src"
34+
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"Georgeboot\\LaravelEchoApiGateway\\Tests\\": "tests"
39+
}
40+
},
41+
"scripts": {
42+
"test": "vendor/bin/phpunit"
43+
},
44+
"extra": {
45+
"laravel": {
46+
"providers": [
47+
"Georgeboot\\LaravelEchoApiGateway\\LaravelEchoApiGatewayServiceProvider"
48+
]
49+
}
50+
},
51+
"config": {
52+
"sort-packages": true
53+
},
54+
"minimum-stability": "dev",
55+
"prefer-stable": true
56+
}

0 commit comments

Comments
 (0)