Skip to content

Commit 39f93cf

Browse files
committed
Carpe Diem
0 parents  commit 39f93cf

Some content is hidden

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

52 files changed

+1466
-0
lines changed

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Enforce Unix newlines
2+
* text=lf
3+
4+
# Exclude unused files
5+
/.gitattributes export-ignore
6+
/.githooks export-ignore
7+
/.github export-ignore
8+
/.gitignore export-ignore
9+
/coverage export-ignore
10+
/README.md export-ignore
11+
/phpunit.xml export-ignore
12+
/phpcs.xml export-ignore
13+
/phpstan.neon export-ignore
14+
/art export-ignore
15+
/docs export-ignore
16+
/tests export-ignore

.githooks/pre-commit

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
vendor/bin/phpunit --colors=always;
4+
5+
if [ $? -gt 0 ]
6+
then
7+
echo "Aborting commit ..."
8+
exit 1
9+
fi
10+
11+
vendor/bin/phpcs
12+
13+
if [ $? -gt 0 ]
14+
then
15+
echo "Aborting commit ..."
16+
exit 1
17+
fi
18+
19+
vendor/bin/phpstan analyse -c phpstan.neon
20+
21+
if [ $? -gt 0 ]
22+
then
23+
echo "Aborting commit ..."
24+
exit 1
25+
fi
26+
27+
exit 0

.githooks/pre-push

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
vendor/bin/phpunit --colors=always;
4+
5+
if [ $? -gt 0 ]
6+
then
7+
echo "Aborting commit ..."
8+
exit 1
9+
fi
10+
11+
vendor/bin/phpcs
12+
13+
if [ $? -gt 0 ]
14+
then
15+
echo "Aborting commit ..."
16+
exit 1
17+
fi
18+
19+
vendor/bin/phpstan analyse -c phpstan.neon
20+
21+
if [ $? -gt 0 ]
22+
then
23+
echo "Aborting commit ..."
24+
exit 1
25+
fi
26+
27+
exit 0

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
name: Test on PHP ${{ matrix.php-versions }}
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php-versions: ['8.1', '8.2', '8.3']
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-versions }}
27+
coverage: none
28+
29+
- name: Install composer and dependencies
30+
uses: php-actions/composer@v6
31+
32+
- name: PHPUnit Tests
33+
uses: php-actions/phpunit@v3
34+
env:
35+
XDEBUG_MODE: coverage
36+
with:
37+
bootstrap: vendor/autoload.php
38+
configuration: phpunit.xml
39+
php_extensions: xdebug
40+
args: tests --coverage-clover ./coverage.xml
41+
42+
- name: Upload to Codecov
43+
uses: codecov/codecov-action@v2
44+
with:
45+
token: ${{ secrets.CODE_COV_TOKEN }}
46+
files: ./coverage.xml
47+
verbose: true
48+
49+
phpstan:
50+
name: PHPStan
51+
runs-on: ubuntu-latest
52+
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
php-versions: ['8.1', '8.2', '8.3']
57+
58+
steps:
59+
- uses: actions/checkout@v3
60+
61+
- name: Setup PHP
62+
uses: shivammathur/setup-php@v2
63+
with:
64+
php-version: ${{ matrix.php-versions }}
65+
coverage: none
66+
67+
- name: Install Composer Dependencies
68+
uses: ramsey/composer-install@v2
69+
70+
- name: Run phpstan
71+
run: vendor/bin/phpstan analyse -c phpstan.neon --xdebug --no-progress
72+
cscheck:
73+
name: Code Sniffer check
74+
runs-on: ubuntu-latest
75+
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
php-versions: ['8.1', '8.2', '8.3']
80+
81+
steps:
82+
- uses: actions/checkout@v3
83+
84+
- name: Setup PHP
85+
uses: shivammathur/setup-php@v2
86+
with:
87+
php-version: ${{ matrix.php-versions }}
88+
coverage: none
89+
90+
- name: Install Composer Dependencies
91+
uses: ramsey/composer-install@v2
92+
93+
- name: Run Code Sniffer
94+
run: vendor/bin/phpcs

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.phpunit.cache
2+
vendor
3+
composer.lock
4+
.DS_Store

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
First and foremost, thank you for your interest in contributing to this package 🙏
4+
5+
There some ways to contribute. Some of them don't involve any coding.
6+
7+
- [Contributing](#contributing)
8+
- [Spread the word](#spread-the-word)
9+
- [Code contributions](#code-contributions)
10+
- [Guidelines](#guidelines)
11+
- [Running Tests](#running-tests)
12+
- [Documentation](#documentation)
13+
14+
## Spread the word
15+
16+
This is perhaps the most impactful contribution you can make. __Spread the
17+
word__. Online on your favorite social media channels. Offline to your dear fellow
18+
developers who are looking for such a package 📢
19+
20+
## Code contributions
21+
22+
Contributions are welcome, and are accepted via pull requests. Please review these guidelines before submitting any pull requests.
23+
24+
### Guidelines
25+
26+
* Please follow the [PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/).
27+
* Ensure that the current tests pass, and if you've added something new, add the tests where relevant.
28+
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash](http://git-scm.com/book/en/Git-Tools-Rewriting-History) them before submitting.
29+
* You may also need to [rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) to avoid merge conflicts.
30+
31+
### Running Tests
32+
33+
You will need to install [Composer](https://getcomposer.org) before continuing.
34+
35+
First, install the dependencies:
36+
37+
```bash
38+
$ composer install
39+
```
40+
41+
Then run phpunit, phpstan and code sniffer:
42+
43+
```bash
44+
$ composer check
45+
```
46+
47+
If the test suite passes on your local machine you should be good to go.
48+
49+
> *PRO TIP* : Install the git hooks by running `composer githooks`. This will make git run phpunit, phpstan and code sniffer before committing or pushing to remote.
50+
51+
## Documentation
52+
53+
If you are adding a new feature or changing functionalities please also update the proper documentation under the `./docs` folder. We are using [docsify](https://docsify.js.org/) for the docs.
54+
55+
If you notice any typos or grammar issues, feel free to make a pull request with fixes or add missing documentation 📚

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Alejandro Morelos
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 all
13+
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 THE
21+
SOFTWARE.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<p align="center">
2+
<img style="padding: 25px" height="50" src="./art/unbounce-plus-php.png">
3+
</p>
4+
5+
<p align="center">
6+
<a href="https://packagist.org/packages/adrosoftware/unbounce-api-php-sdk">
7+
<img alt="Latest Stable Version" src="https://img.shields.io/packagist/v/adrosoftware/unbounce-api-php-sdk.svg">
8+
</a>
9+
<a href="https://codecov.io/gh/adrosoftware/unbounce-api-php-sdk" >
10+
<img src="https://codecov.io/gh/adrosoftware/unbounce-api-php-sdk/branch/main/graph/badge.svg?token=SI4NXOC1AX"/>
11+
</a>
12+
<a href="https://github.com/adrosoftware/unbounce-api-php-sdk/actions/workflows/ci.yml">
13+
<img alt="Test - CI" src="https://github.com/adrosoftware/unbounce-api-php-sdk/actions/workflows/ci.yml/badge.svg">
14+
</a>
15+
<a href="https://github.com/adrosoftware/unbounce-api-php-sdk/blob/main/LICENSE">
16+
<img alt="License" src="https://img.shields.io/github/license/adrosoftware/unbounce-api-php-sdk">
17+
</a>
18+
<img alt="Last commit" src="https://img.shields.io/github/last-commit/adrosoftware/unbounce-api-php-sdk.svg">
19+
</p>
20+
21+
# Unofficial Unbounce SDK for PHP
22+
23+
This is a Object Oriented wrapper for the [Unbounce](https://unbounce.com/) API, written with PHP. The full Unbounce API documentation can be found [here](https://developer.unbounce.com/api_reference/).
24+
25+
## Documentation
26+
27+
To see full documentation visit the oficial [documentation](https://adrosoftware.github.io/unbounce-api-php-sdk/)
28+
29+
## Requirements
30+
31+
* PHP >= 8.1
32+
* A [PSR-17 implementation](https://packagist.org/providers/psr/http-factory-implementation)
33+
* A [PSR-18 implementation](https://packagist.org/providers/psr/http-client-implementation)
34+
35+
## How to use it
36+
37+
_This package is decoupled from any HTTP messaging client with help by [HTTPlug](https://httplug.io). For this reason you need to install a PSR-17 and PSR-18 implementation packages. Example: `composer require symfony/http-client nyholm/psr7`._
38+
39+
Require the package with [composer](https://getcomposer.org/):
40+
41+
```bash
42+
composer require adrosoftware/unbounce-api-php-sdk
43+
```
44+
45+
Create an instance on your codebase as follows and then you will be good to start interacting with the Circle API.
46+
47+
```php
48+
<?php
49+
50+
declare(strict_types=1);
51+
52+
use AdroSoftware\UnbounceSdk\Unbounce;
53+
54+
$unbounce = Unbounce::make('5up3r53cr3770k3n');
55+
56+
// Interact with the API.
57+
58+
$accounts = $unbounce->accounts()->all();
59+
```
60+
61+
## License
62+
63+
This package is licensed under the MIT License - see the [LICENSE](https://github.com/adrosoftware/unbounce-api-php-sdk/blob/main/LICENSE) file for details
64+
65+
## Maintainers
66+
67+
This library is maintained by:
68+
- [Adro Morelos](https://github.com/adrorocker)
69+
70+
## Contributors
71+
72+
See all the contributors [here](https://github.com/adrosoftware/unbounce-api-php-sdk/graphs/contributors)

art/unbounce-plus-php.png

4.15 KB
Loading

composer.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "adrosoftware/unbounce-api-php-sdk",
3+
"description": "A PHP SDK to interact with the unbounce.com API",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Adro Morelos",
9+
"email": "me@adro.rocks"
10+
}
11+
],
12+
"minimum-stability": "stable",
13+
"require": {
14+
"php": "^8.1.0",
15+
"php-http/client-common": "^2.3",
16+
"php-http/discovery": "^1.12",
17+
"psr/http-client": "^1.0",
18+
"psr/http-client-implementation": "^1.0",
19+
"psr/http-factory": "^1.0",
20+
"psr/http-message": "^1.0",
21+
"symfony/options-resolver": "^6.2"
22+
},
23+
"require-dev": {
24+
"guzzlehttp/guzzle": "^7.5",
25+
"php-http/guzzle7-adapter": "^1.0",
26+
"php-http/message": "^1.0",
27+
"phpstan/phpstan": "^1.10",
28+
"phpunit/phpunit": "^10.0",
29+
"squizlabs/php_codesniffer": "^3.7",
30+
"symfony/var-dumper": "^6.2"
31+
},
32+
"autoload": {
33+
"psr-4": {
34+
"AdroSoftware\\UnbounceSdk\\": "src"
35+
}
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"AdroSoftware\\UnbounceSdk\\Tests\\": "tests"
40+
},
41+
"files": [
42+
"tests/helpers.php"
43+
]
44+
},
45+
"config": {
46+
"allow-plugins": {
47+
"php-http/discovery": true
48+
},
49+
"sort-packages": true
50+
},
51+
"scripts": {
52+
"check": [
53+
"@phpunit",
54+
"@phpstan",
55+
"@cscheck"
56+
],
57+
"githooks": [
58+
"@pre-commit",
59+
"@pre-push"
60+
],
61+
"pre-commit": "cp ./.githooks/pre-commit ./.git/hooks/pre-commit && chmod a+x ./.git/hooks/pre-commit",
62+
"pre-push": "cp ./.githooks/pre-push ./.git/hooks/pre-push && chmod a+x ./.git/hooks/pre-push",
63+
"phpunit": "./vendor/bin/phpunit",
64+
"cscheck": "./vendor/bin/phpcs",
65+
"csfix": "./vendor/bin/phpcbf",
66+
"phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon",
67+
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html ./.phpunit.cache/logs/html && chmod a+x ./coverage && ./coverage"
68+
}
69+
}

0 commit comments

Comments
 (0)