hands-on-ekino-php/your-client
最新稳定版本:v1
Composer 安装命令:
composer require hands-on-ekino-php/your-client
包简介
test
README 文档
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.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-04