hands-on-ekino-php / your-client
test
v1
2025-04-04 09:58 UTC
Requires
- symfony/http-client: ^7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^11
- symfony/config: ^7.2
- symfony/dependency-injection: ^7.2
- symfony/http-kernel: ^7.2
This package is not auto-updated.
Last update: 2025-09-06 10:09:31 UTC
README
A PHP client library for interacting with the JSONPlaceholder API, with easy Symfony integration.
Features
- Simple and clean API client for JSONPlaceholder
- Easy integration with Symfony applications
- Customizable HTTP client configuration
- Optional clock emoji header for fun
Installation
Install the library via composer:
composer require hands-on-ekino-php/your-client
Usage
Basic usage with Symfony
- Register the bundle in your
config/bundles.php
:
return [ // ...other bundles HandsOnEkinoPhp\YourClient\Bridge\Symfony\HandsOnEkinoPhpBundle::class => ['all' => true], ];
- Configure the client in your
config/packages/hands_on.yaml
:
hands_on_ekino_php: client: clock_header: true # Set to false to disable the clock emoji header name: todos_client # The name of your HTTP client service
- Configure your HTTP client in
config/packages/framework.yaml
:
framework: http_client: scoped_clients: todos_client: base_uri: 'https://jsonplaceholder.typicode.com'
- Use the client in your actions or services:
<?php namespace App\Action; use HandsOnEkinoPhp\YourClient\Client\TodosClient; use Symfony\Component\HttpFoundation\JsonResponse; class MyAction { public function __invoke(TodosClient $todosClient): JsonResponse { // The client is automatically injected thanks to Symfony's autowiring return $todosClient->getTodos(); } }
Development
Running tests
vendor/bin/phpunit
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This library is open-sourced software licensed under the MIT license.