Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Ponty committed Jun 5, 2023
0 parents commit 8347629
Show file tree
Hide file tree
Showing 11 changed files with 565 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PHPCS-Fixer

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
phpcsfixer:
runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.1", "8.2"]

name: PHP ${{ matrix.php-versions }} CS-Fixer ${{ matrix.operating-system }}

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install Composer packages
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run PHP-CS-Fixer
run: $GITHUB_WORKSPACE/vendor/bin/php-cs-fixer fix --dry-run
33 changes: 33 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PHPStan

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
phpstan:
runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.1", "8.2"]

name: PHP ${{ matrix.php-versions }} Static Analysis on ${{ matrix.operating-system }}

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install Composer packages
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run PHPSTAN
run: $GITHUB_WORKSPACE/vendor/bin/phpstan --level=9 --error-format=github
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/vendor/
/composer.lock

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
28 changes: 28 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);

if (!\file_exists(__DIR__.'/src')) {
exit(0);
}

return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'@Symfony:risky' => false,
'protected_to_private' => false,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => false,
'blank_line_after_opening_tag' => false,
'phpdoc_annotation_without_dot' => false,
'yoda_style' => false,
'single_line_throw' => false,
'native_function_invocation' => [
'include' => ['@internal'],
],
])
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->append([__FILE__])
)
;
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2023 Guillaume Ponty

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.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Symfony Monday Api

This is a Symfony 6 Bundle helps you to use monday API v2 : https://developer.monday.com/apps/docs/mondayapi.

## Installation

**1** Add to composer.json to the `require` key

``` shell
composer require gponty/symfony-monday-api-bundle
```

**2** Add to local .env file

``` shell
MONDAY_API_KEY=your_token
```

**3** Add to framework config file config/packages/framework.yml

``` shell
monday:
api_key: '%env(MONDAY_API_KEY)%'
```


## Usage

Inject the service in your controller :

``` php
public function __construct(readonly MondayApiService $mondayApiService)
{ }
```

Use the service :

``` php
$query = '{
boards(ids: 123456789) {
id
name
groups {
id
title
items(limit: 100, page:1) {
id
name
}
}
}
}';
$response = $this->mondayApiService->request($query);
```

## License

This bundle is under the MIT license. See the complete license in the bundle.
36 changes: 36 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "gponty/symfony-monday-api-bundle",
"description": "Service to use api Monday.com in Symfony",
"type": "symfony-bundle",
"require": {
"php": ">=8.1",
"symfony/http-kernel": "^6.3",
"symfony/config": "^6.3",
"symfony/dependency-injection": "^6.3"
},
"keywords": ["symfony", "monday", "api", "bundle"],
"homepage": "https://github.com/gponty/symfony-monday-api",
"autoload": {
"psr-4": {
"Gponty\\MondayBundle\\": "src/"
}
},
"license": "MIT",
"authors": [
{
"name": "Guillaume Ponty",
"email": "[email protected]"
}
],
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.17",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-symfony": "^1.3"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
10 changes: 10 additions & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# config/services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
# ...

Gponty\MondayBundle\MondayApi:
# redundant thanks to _defaults, but value is overridable on each service
autowire: true
8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
parameters:
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
ignoreErrors:
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\).#'

paths:
- src
Loading

0 comments on commit 8347629

Please sign in to comment.