generated from owenvoke/skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f835b57
Showing
34 changed files
with
1,019 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at https://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_size = 4 | ||
indent_style = space | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
* text=auto | ||
|
||
# Path-based git attributes | ||
# https://git-scm.com/docs/gitattributes | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.github export-ignore | ||
/.gitignore export-ignore | ||
/CHANGELOG.md export-ignore | ||
/docs export-ignore | ||
/phpstan.neon.dist export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/owenvoke/ems-esp). | ||
|
||
## Pull Requests | ||
|
||
- **Laravel Coding Standard** - This is automatically linted by [Pint](https://github.com/laravel/pint). | ||
|
||
- **Add tests!** - If possible, try to add tests to support your patch. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org). Randomly breaking public APIs is not an option. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your main branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# These are supported funding model platforms | ||
|
||
github: owenvoke | ||
custom: "https://ecologi.com/owenvoke?gift-trees" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Bug Report | ||
about: If something isn't working as expected. | ||
|
||
--- | ||
|
||
<!-- Provide a general summary of the issue in the Title above --> | ||
|
||
## Description | ||
|
||
Make it clear if the issue is a bug, an enhancement or just a question. | ||
|
||
## Your environment | ||
|
||
Include as many relevant details about the environment you experienced the bug in and how to reproduce it. | ||
|
||
* Version used (e.g. PHP 8.1, 8.2): | ||
* Operating system and version (e.g. Ubuntu 22.x, Windows 10): | ||
* ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: Feature Request | ||
about: I have a suggestion (and may want to implement it). | ||
|
||
--- | ||
|
||
<!-- Provide a general summary of the feature in the Title above --> | ||
|
||
## Description | ||
|
||
Provide a detailed description of the change or addition you are proposing. | ||
|
||
## Possible implementation | ||
|
||
Not obligatory, but suggest an idea for implementing addition or change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!--- Provide a general summary of your changes in the Title above --> | ||
|
||
... | ||
|
||
Please check the **[CONTRIBUTING](https://github.com/owenvoke/.github/blob/main/CONTRIBUTING.md)** document for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Static Analysis | ||
|
||
on: ['push', 'pull_request'] | ||
|
||
jobs: | ||
pint: | ||
runs-on: ubuntu-latest | ||
|
||
name: Pint | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
coverage: none | ||
|
||
- name: Install Dependencies | ||
run: composer update --no-interaction --prefer-dist --no-progress --ansi | ||
|
||
- name: Run Pint | ||
run: vendor/bin/pint --test --ansi | ||
|
||
phpstan: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
dependency-version: [prefer-lowest, prefer-stable] | ||
|
||
name: PHPStan (${{ matrix.dependency-version }}) | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
coverage: none | ||
|
||
- name: Install Dependencies | ||
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress --ansi | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/phpstan analyse --no-progress --ansi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Tests | ||
|
||
on: ['push', 'pull_request'] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
php: ['8.2'] | ||
dependency-version: [prefer-lowest, prefer-stable] | ||
|
||
name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: composer | ||
coverage: none | ||
|
||
- name: Setup Problem Matches | ||
run: | | ||
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
- name: Install PHP dependencies | ||
run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi | ||
|
||
- name: Unit Tests | ||
run: vendor/bin/pest --colors=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/build | ||
/vendor | ||
/.phpunit.cache | ||
/.php-cs-fixer.cache | ||
/composer.lock | ||
/phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). | ||
|
||
## Unreleased |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright (c) Owen Voke <development@voke.dev> | ||
|
||
>Permission is hereby granted, free of charge, to any person obtaining a copy | ||
>of this software and associated documentation files (the "Software"), to deal | ||
>in the Software without restriction, including without limitation the rights | ||
>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
>copies of the Software, and to permit persons to whom the Software is | ||
>furnished to do so, subject to the following conditions: | ||
> | ||
>The above copyright notice and this permission notice shall be included in | ||
>all copies or substantial portions of the Software. | ||
> | ||
>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
>THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# EMS-ESP PHP | ||
|
||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Software License][ico-license]](LICENSE.md) | ||
[![Build Status][ico-github-actions]][link-github-actions] | ||
[![Static Analysis][ico-static-analysis]][link-static-analysis] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
[![Buy us a tree][ico-treeware-gifting]][link-treeware-gifting] | ||
|
||
An object-oriented PHP wrapper for the EMS-ESP API | ||
|
||
## Requirements | ||
|
||
- PHP >= 8.2 | ||
- A [PSR-17 implementation](https://packagist.org/providers/psr/http-factory-implementation) | ||
- A [PSR-18 implementation](https://packagist.org/providers/psr/http-client-implementation) | ||
|
||
## Install | ||
|
||
Via Composer | ||
|
||
```shell | ||
composer require owenvoke/ems-esp guzzlehttp/guzzle:^7.5 http-interop/http-factory-guzzle:^1.2 | ||
``` | ||
|
||
We are decoupled from any HTTP messaging client with help by [HTTPlug](https://httplug.io). | ||
|
||
## Usage | ||
|
||
**Basic usage** | ||
|
||
```php | ||
// Include the Composer autoloader | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
$client = new \OwenVoke\EMSESP\Client(url: 'http://ems-esp.local'); | ||
$boiler = $client->device()->info('boiler'); | ||
``` | ||
|
||
**Authentication** | ||
|
||
> Note: The EMS-ESP API only supports authentication via an API token. | ||
```php | ||
use OwenVoke\EMSESP\Client; | ||
use OwenVoke\EMSESP\Enums\AuthMethod; | ||
|
||
$client = new Client(); | ||
$client->authenticate($apiToken); | ||
``` | ||
|
||
## Change log | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Testing | ||
|
||
```shell | ||
composer test | ||
``` | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email security@voke.dev instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [Owen Voke][link-author] | ||
- [All Contributors][link-contributors] | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. | ||
|
||
## Treeware | ||
|
||
You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree. | ||
|
||
It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats. | ||
|
||
You can buy trees [here][link-treeware-gifting]. | ||
|
||
Read more about Treeware at [treeware.earth][link-treeware]. | ||
|
||
[ico-version]: https://img.shields.io/packagist/v/owenvoke/ems-esp.svg?style=flat-square | ||
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square | ||
[ico-github-actions]: https://img.shields.io/github/actions/workflow/status/owenvoke/ems-esp/tests.yml?branch=main&style=flat-square&label=Tests | ||
[ico-static-analysis]: https://img.shields.io/github/actions/workflow/status/owenvoke/ems-esp/static.yml?branch=main&style=flat-square&label=Static%20Analysis | ||
[ico-downloads]: https://img.shields.io/packagist/dt/owenvoke/ems-esp.svg?style=flat-square | ||
[ico-treeware-gifting]: https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/owenvoke/ems-esp | ||
[link-github-actions]: https://github.com/owenvoke/ems-esp/actions | ||
[link-static-analysis]: https://github.com/owenvoke/ems-esp/actions/workflows/static.yml | ||
[link-downloads]: https://packagist.org/packages/owenvoke/ems-esp | ||
[link-treeware]: https://treeware.earth | ||
[link-treeware-gifting]: https://ecologi.com/owenvoke?gift-trees | ||
[link-author]: https://github.com/owenvoke | ||
[link-contributors]: ../../contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "owenvoke/ems-esp", | ||
"type": "library", | ||
"description": "An object oriented PHP wrapper for the EMS-ESP API", | ||
"license": "MIT", | ||
"require": { | ||
"php": "^8.2", | ||
"php-http/client-common": "^2.4", | ||
"php-http/discovery": "^1.14", | ||
"php-http/httplug": "^2.2", | ||
"php-http/multipart-stream-builder": "^1.1", | ||
"psr/http-client-implementation": "^1.0", | ||
"psr/http-factory-implementation": "^1.0", | ||
"psr/http-message": "^1.0" | ||
}, | ||
"require-dev": { | ||
"guzzlehttp/guzzle": "^7.4", | ||
"guzzlehttp/psr7": "^2.1", | ||
"http-interop/http-factory-guzzle": "^1.2", | ||
"laravel/pint": "^1.13", | ||
"pestphp/pest": "^2.20", | ||
"php-http/mock-client": "^1.5", | ||
"phpstan/phpstan": "^1.10", | ||
"symfony/var-dumper": "^6.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"OwenVoke\\EMSESP\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"OwenVoke\\EMSESP\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"lint": "pint --ansi", | ||
"test:lint": "pint --test --ansi", | ||
"test:types": "phpstan analyse --ansi --memory-limit=-1", | ||
"test:unit": "pest --colors=always", | ||
"test": [ | ||
"@test:lint", | ||
"@test:types", | ||
"@test:unit" | ||
] | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true, | ||
"php-http/discovery": true | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
parameters: | ||
level: 6 | ||
paths: | ||
- src/ | ||
|
||
checkMissingIterableValueType: false | ||
checkGenericClassInNonGenericObjectType: false | ||
reportUnmatchedIgnoredErrors: true |
Oops, something went wrong.