Skip to content

Commit e00d426

Browse files
committed
[ADD] Initial Commit
0 parents  commit e00d426

18 files changed

+733
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

.styleci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: laravel

changelog.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
All notable changes to `Agora SDK PHP` will be documented in this file.
4+
5+
## Version 1.0
6+
7+
### Added
8+
- Everything

composer.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "willywes/agora-sdk-php",
3+
"description": "Agora.io SDK PHP",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Alejandro Isla",
8+
"email": "alejandro.isla.c@gmail.com",
9+
"homepage": "http://alejandroisla.cl"
10+
}
11+
],
12+
"homepage": "https://github.com/willywes/agora-sdk-php",
13+
"keywords": ["Laravel", "Agora.io", "SDK", "Agora SDK", "PHP", "Agora SDK PHP"],
14+
"require": {
15+
"illuminate/support": "~7|~8"
16+
},
17+
"require-dev": {
18+
"phpunit/phpunit": "~9.0",
19+
"orchestra/testbench": "~5|~6"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"Willywes\\AgoraSDK\\": "src/"
24+
}
25+
},
26+
"autoload-dev": {
27+
"psr-4": {
28+
"Willywes\\AgoraSDK\\Tests\\": "tests"
29+
}
30+
},
31+
"extra": {
32+
"laravel": {
33+
"providers": [
34+
"Willywes\\AgoraSDK\\AgoraSDKServiceProvider"
35+
],
36+
"aliases": {
37+
"AgoraSDK": "Willywes\\AgoraSDK\\Facades\\AgoraSDK"
38+
}
39+
}
40+
}
41+
}

config/agorasdk.php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
return [
4+
'order' => [
5+
'by' => 'DESC',
6+
'as' => 'created_at',
7+
],
8+
];

contributing.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing
2+
3+
Contributions are welcome and will be fully credited.
4+
5+
Contributions are accepted via Pull Requests on [Github](https://github.com/willywes/agorasdk).
6+
7+
# Things you could do
8+
If you want to contribute but do not know where to start, this list provides some starting points.
9+
- Add license text
10+
- Remove rewriteRules.php
11+
- Set up TravisCI, StyleCI, ScrutinizerCI
12+
- Write a comprehensive ReadMe
13+
14+
## Pull Requests
15+
16+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
17+
18+
- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date.
19+
20+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
21+
22+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
23+
24+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
25+
26+
27+
**Happy coding**!

license.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# The license
2+
3+
Copyright (c) author name <author email>
4+
5+
...Add your license text here...

phpunit.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Package">
14+
<directory suffix=".php">./tests/</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory>src/</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>

readme.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# AgoraSDK
2+
3+
[![Latest Version on Packagist][ico-version]][link-packagist]
4+
[![Total Downloads][ico-downloads]][link-downloads]
5+
[![Build Status][ico-travis]][link-travis]
6+
[![StyleCI][ico-styleci]][link-styleci]
7+
8+
This is where your description should go. Take a look at [contributing.md](contributing.md) to see a to do list.
9+
10+
## Installation
11+
12+
Via Composer
13+
14+
``` bash
15+
$ composer require willywes/agora-sdk-php
16+
```
17+
18+
## Usage
19+
20+
``` php
21+
use Willywes\AgoraSDK\RtcTokenBuilder;
22+
23+
class AgoraHelper
24+
{
25+
public static function GetToken($user_id){
26+
27+
$appID = "72fc...";
28+
$appCertificate = "72fc...";
29+
$channelName = "Test";
30+
$uid = $user_id;
31+
$uidStr = ($user_id) . '';
32+
$role = RtcTokenBuilder::RoleAttendee;
33+
$expireTimeInSeconds = 3600;
34+
$currentTimestamp = (new \DateTime("now", new \DateTimeZone('UTC')))->getTimestamp();
35+
$privilegeExpiredTs = $currentTimestamp + $expireTimeInSeconds;
36+
37+
return RtcTokenBuilder::buildTokenWithUid($appID, $appCertificate, $channelName, $uid, $role, $privilegeExpiredTs);
38+
39+
}
40+
}
41+
```
42+
43+
``` php
44+
$user = auth()->user();
45+
$agora_token = AgoraHelper::GetToken($user->id);
46+
```
47+
## Change log
48+
49+
Please see the [changelog](changelog.md) for more information on what has changed recently.
50+
51+
## Testing
52+
53+
``` bash
54+
$ composer test
55+
```
56+
57+
## Contributing
58+
59+
Please see [contributing.md](contributing.md) for details and a todolist.
60+
61+
## Security
62+
63+
If you discover any security related issues, please email author email instead of using the issue tracker.
64+
65+
## Credits
66+
67+
- [author name][link-author]
68+
- [All Contributors][link-contributors]
69+
70+
## License
71+
72+
license. Please see the [license file](license.md) for more information.
73+
74+
[ico-version]: https://img.shields.io/packagist/v/willywes/agora-sdk-php.svg?style=flat-square
75+
[ico-downloads]: https://img.shields.io/packagist/dt/willywes/agora-sdk-php.svg?style=flat-square
76+
[ico-travis]: https://img.shields.io/travis/willywes/agora-sdk-php/master.svg?style=flat-square
77+
[ico-styleci]: https://styleci.io/repos/12345678/shield
78+
79+
[link-packagist]: https://packagist.org/packages/willywes/agora-sdk-php
80+
[link-downloads]: https://packagist.org/packages/willywes/agora-sdk-php
81+
[link-travis]: https://travis-ci.org/willywes/agora-sdk-php
82+
[link-styleci]: https://styleci.io/repos/12345678
83+
[link-author]: https://github.com/willywes
84+
[link-contributors]: ../../contributors

0 commit comments

Comments
 (0)