denniscarrazeiro/php-curl-module
最新稳定版本:1.0.0
Composer 安装命令:
composer require denniscarrazeiro/php-curl-module
包简介
A library that proposes handle curl php module. Consider that Module goes be use in PHP projects.
关键字:
README 文档
README
The Php Curl Module provides a robust and flexible way to perform HTTP requests within PHP applications, leveraging the power of the cURL extension. Through its intuitive fluent interface, developers can effortlessly configure a wide range of request options, including the target URL, custom HTTP headers, user agent, timeout settings, SSL verification preferences, data for POST requests, HTTP authentication credentials, and even define custom HTTP methods like PUT or DELETE. This class simplifies the process of interacting with web services and APIs, enabling seamless data retrieval and submission with granular control over the underlying HTTP communication.
Instalation
bash ./scripts/composer_install.sh
Composer is a dependency manager for the PHP programming language. Therefore, after running the command above, Composer will install all the necessary dependencies to ensure the project functions under the best possible conditions.
Unit Tests
bash ./scripts/phpunit_tests.sh
PHPUnit is a programmer-oriented testing framework for PHP, designed to facilitate the creation and execution of unit tests. Consequently, after setting up your test suite and running the appropriate command, PHPUnit will execute your tests and provide detailed feedback, ensuring your codebase maintains a high level of quality and reliability.
Usage Example 1
require 'Curl.php'; // Make sure to include the Curl class file use DennisCarrazeiro\Php\Curl\Module\Curl\Curl; $curl = new Curl(); $response = $curl->url('https://api.example.com/users') ->returnTransfer(true) // Returns the response as a string ->execute(); if ($curl->statusCode() === 200) { echo "Successful GET request!\n"; // Process the response (usually in JSON) $data = json_decode($response, true); print_r($data); } else { echo "GET request failed. Status code: " . $curl->statusCode() . "\n"; if ($errors = $curl->getValidationsErrors()) { echo "Error details: " . implode(", ", $errors) . "\n"; } }
Usage Example 2
require_once(__DIR__."/../vendor/autoload.php"); use \DennisCarrazeiro\Php\Curl\Module\Curl\Curl; $data = [ 'name' => 'New User', 'email' => 'new.user@example.com' ]; $jsonData = json_encode($data); $curl = new Curl('application/json'); // Sets the Content-Type in the constructor $response = $curl->url('https://api.example.com/users') ->customRequest('POST') // Sets the method to POST ->postFields($jsonData) // Sends the JSON data in the body ->addHeader('X-API-Key: your_api_key') // Adds a custom header ->returnTransfer(true) ->execute(); if ($curl->statusCode() === 201) { // Status code 201 usually indicates successful creation echo "User created successfully!\n"; $responseData = json_decode($response, true); print_r($responseData); } else { echo "Error creating user. Status code: " . $curl->statusCode() . "\n"; if ($errors = $curl->getValidationsErrors()) { echo "Error details: " . implode(", ", $errors) . "\n"; } }
More Examples
For more examples see the Examples folder.
License
The MIT license. Please see License file for more information.
denniscarrazeiro/php-curl-module 适用场景与选型建议
denniscarrazeiro/php-curl-module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「curl」 「Carrazeiro」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 denniscarrazeiro/php-curl-module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 denniscarrazeiro/php-curl-module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 denniscarrazeiro/php-curl-module 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
cURL and cURL based Soap-Client for PHP
Simple cURL wrapper
A fluent PHP CURL wrapper
Build mini web servers in PHP for testing
Async Curl using React\ChildProcess
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-04