Skip to content

Commit a6bee28

Browse files
committed
Initial commit
0 parents  commit a6bee28

File tree

871 files changed

+110619
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

871 files changed

+110619
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Dependencies
2+
/vendor
3+
4+
# Composer
5+
composer.lock
6+
composer.phar
7+
8+
# CS
9+
.php_cs.cache

.jane-openapi.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
return [
4+
'openapi-file' => __DIR__ . '/resources/slack-openapi.json',
5+
'namespace' => 'JoliCode\Slack\Api',
6+
'directory' => __DIR__ . '/generated/',
7+
'reference' => true,
8+
];

.php_cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of JoliCode's Slack PHP API project.
5+
6+
(c) JoliCode <[email protected]>
7+
8+
For the full copyright and license information, please view the LICENSE
9+
file that was distributed with this source code.
10+
EOF;
11+
12+
return PhpCsFixer\Config::create()
13+
->setRiskyAllowed(true)
14+
->setRules(array(
15+
'@Symfony' => true,
16+
'@Symfony:risky' => true,
17+
'header_comment' => array('header' => $header),
18+
'array_syntax' => array('syntax' => 'short'),
19+
'ordered_class_elements' => true,
20+
'ordered_imports' => true,
21+
'heredoc_to_nowdoc' => true,
22+
'php_unit_strict' => true,
23+
'php_unit_construct' => true,
24+
'phpdoc_add_missing_param_annotation' => true,
25+
'phpdoc_order' => true,
26+
'strict_comparison' => true,
27+
'strict_param' => true,
28+
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'),
29+
'no_short_echo_tag' => true,
30+
'no_unreachable_default_argument_value' => true,
31+
'no_useless_else' => true,
32+
'no_useless_return' => true,
33+
'semicolon_after_instruction' => true,
34+
'combine_consecutive_unsets' => true,
35+
))
36+
->setFinder(
37+
PhpCsFixer\Finder::create()
38+
->in(__DIR__)
39+
->exclude('generated')
40+
)
41+
;

CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Contributing
2+
3+
First of all, **thank you** for contributing, **you are awesome**!
4+
5+
Everybody should be able to help. Here's how you can do it:
6+
7+
1. [Fork it](https://github.com/jolicode/slack-php-api/fork_select)
8+
2. improve it
9+
3. submit a [pull request](https://help.github.com/articles/creating-a-pull-request)
10+
11+
Here's some tips to make you the best contributor ever:
12+
13+
* [Rules](#rules)
14+
* [Standard code](#standard-code)
15+
* [Keeping your fork up-to-date](#keeping-your-fork-up-to-date)
16+
17+
## Rules
18+
19+
Here are a few rules to follow in order to ease code reviews, and discussions
20+
before maintainers accept and merge your work.
21+
22+
* You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
23+
[PSR-2](http://www.php-fig.org/psr/2/) (see [Rules](#rules)).
24+
* You SHOULD write documentation.
25+
26+
Please, write [commit messages that make
27+
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
28+
and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing)
29+
before submitting your Pull Request (see also how to [keep your
30+
fork up-to-date](#keeping-your-fork-up-to-date)).
31+
32+
One may ask you to [squash your
33+
commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
34+
too. This is used to "clean" your Pull Request before merging it (we don't want
35+
commits such as `fix tests`, `fix 2`, `fix 3`, etc.).
36+
37+
Also, while creating your Pull Request on GitHub, you MUST write a description
38+
which gives the context and/or explains why you are creating it.
39+
40+
Your work will then be reviewed as soon as possible (suggestions about some
41+
changes, improvements or alternatives may be given).
42+
43+
## Standard code
44+
45+
Use [PHP CS fixer](http://cs.sensiolabs.org/) to make your code compliant with
46+
our coding standards:
47+
48+
```shell
49+
make cs
50+
```
51+
52+
## Keeping your fork up-to-date
53+
54+
To keep your fork up-to-date, you should track the upstream (original) one
55+
using the following command:
56+
57+
58+
```shell
59+
git remote add upstream https://github.com/jolicode/slack-php-api.git
60+
```
61+
62+
Then get the upstream changes:
63+
64+
```shell
65+
git checkout master
66+
git pull --rebase origin master
67+
git pull --rebase upstream master
68+
git checkout <your-branch>
69+
git rebase master
70+
```
71+
72+
Finally, publish your changes:
73+
74+
```shell
75+
git push -f origin <your-branch>
76+
```
77+
78+
Your pull request will be automatically updated.
79+
80+
81+
Thank you!

LICENSE.md

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

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cs: ## Fix CS violations
2+
./vendor/bin/php-cs-fixer fix --verbose
3+
4+
cs_dry_run: ## Display CS violations without fixing it
5+
./vendor/bin/php-cs-fixer fix --verbose --dry-run
6+
7+
.PHONY: help
8+
9+
help: ## Display this help
10+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
11+
12+
.DEFAULT_GOAL := help

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# A PHP client for Slack's Api
2+
3+
There is a bunch of PHP clients for Slack. But some are not up to date or miss
4+
features, some only cover a small part of the API and most are simply no longer
5+
maintained.
6+
7+
This SDK is generated automatically with [JanePhp](https://github.com/janephp/janephp)
8+
from the [official SLACK API specs](https://github.com/slackapi/slack-api-specs).
9+
10+
## Installation
11+
12+
This library is built atop of PHP-HTTP (read more about it [here](http://docs.php-http.org))
13+
and PSR-7. So you will need to install some implementations for those interfaces.
14+
If no PHP-HTTP adapter or PSR-7 message factory is available yet in your project
15+
or you don't care which one to use, just install some default:
16+
17+
```bash
18+
composer require php-http/curl-client guzzlehttp/psr7
19+
```
20+
21+
You can now install the Slack client:
22+
23+
```bash
24+
composer require jolicode/slack-php-api
25+
```
26+
27+
## Usage
28+
29+
First, you need to retrieve a token - like an OAuth AccessToken or a legacy token.
30+
Checkout Slack's documentation about [all differents kind of tokens](https://api.slack.com/docs/token-types).
31+
32+
Then, use the factory that is provided to create the client:
33+
34+
```php
35+
$client = JoliCode\Slack\ClientFactory::create($yourToken);
36+
37+
$client->apiTest(); // $client contains all the methods to interact with the API
38+
```
39+
40+
## Troubleshoots
41+
42+
Got some problems using this library? Need a missing feature?
43+
Do not hesitate to open an issue and share it with us.
44+
45+
## Updating the SDK
46+
47+
Run the following command to retrieve the latest API spec (beware to not remove
48+
local modifications):
49+
50+
```bash
51+
curl https://api.slack.com/specs/openapi/v2/slack_web.json -o resources/slack-openapi.json
52+
```
53+
54+
Then regenerate the SDK:
55+
56+
```bash
57+
vendor/bin/jane-openapi generate -c .jane-openapi.php
58+
```
59+
60+
## License
61+
62+
This library is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.

VERSIONING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Versioning and branching models
2+
3+
This file explains the versioning and branching models of this project.
4+
5+
## Versioning
6+
7+
The versioning is inspired by [Semantic Versioning](http://semver.org/):
8+
9+
> Given a version number MAJOR.MINOR.PATCH, increment the:
10+
>
11+
> 1. MAJOR version when you make incompatible API changes
12+
> 2. MINOR version when you add functionality in a backwards-compatible manner
13+
> 3. PATCH version when you make backwards-compatible bug fixes
14+
15+
## Branching Model
16+
17+
The branching is inspired by [@jbenet](https://github.com/jbenet)
18+
[simple git branching model](https://gist.github.com/jbenet/ee6c9ac48068889b0912):
19+
20+
> 1. `master` must always be deployable.
21+
> 2. **all changes** are made through feature branches (pull-request + merge)
22+
> 3. rebase to avoid/resolve conflicts; merge in to `master`

composer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "jolicode/slack-php-api",
3+
"description": "An up to date PHP client for Slack's API",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Loïck Piera",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"autoload": {
13+
"psr-4": {
14+
"JoliCode\\Slack\\Api\\": "generated/",
15+
"JoliCode\\Slack\\": "src/"
16+
}
17+
},
18+
"require": {
19+
"php": ">= 7.1",
20+
"jane-php/json-schema-runtime": "^4.0",
21+
"jane-php/open-api-runtime": "^4.0",
22+
"php-http/client-implementation": "*",
23+
"php-http/client-common": "^1.7"
24+
},
25+
"require-dev": {
26+
"jane-php/jane-php": "^4.0",
27+
"php-http/curl-client": "^1.7",
28+
"guzzlehttp/psr7": "^1.4",
29+
"friendsofphp/php-cs-fixer": "^2.13"
30+
}
31+
}

0 commit comments

Comments
 (0)