定制 nextstage-brasil/ns-helpers 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nextstage-brasil/ns-helpers

最新稳定版本:1.0.1

Composer 安装命令:

composer require nextstage-brasil/ns-helpers

包简介

Methods and classes for various utilities

README 文档

README

NsHelpers is a collection of PHP utilities for handling files, directories, dates, JSON, HTTP, and more. This repository contains various classes and functions that facilitate the development of PHP applications.

Project Structure

  • src/Helpers/
    • Validate.php: Validation functions.
    • JsonParser.php: JSON manipulation.
    • File.php: File handling utilities.
    • DirectoryManipulation.php: Directory handling utilities.
    • Date.php: Date handling utilities.
    • Compatibility.php: PHP code compatibility checks.
    • Format.php: Formatting utilities.
    • Packer.php: JavaScript script compression.
  • src/Http/
    • Ssl.php: SSL certificate handling.
    • Response.php: HTTP response handling.
    • Http.php: HTTP request handling.
  • src/Integrations/
    • Cep.php: Integration with CEP API.
  • src/Functions/
    • functions.php: Helper functions.
  • tests/
    • FileTest.php: Unit tests for the File class.

Installation

To install NsHelpers, use Composer: composer require nextstage-brasil/ns-helpers

Usage

HTTP Requests

The Http class provides methods to make HTTP requests. Below are some examples of how to use it.

Making a GET Request

<?php
use NsHelpers\Http\Http;
$response = Http::call('https://api.example.com/data', [], 'GET');
echo $response->getBody(); // Outputs the response body as a string

Making a POST Request

<?php
use NsHelpers\Http\Http;
$params = ['key1' => 'value1', 'key2' => 'value2'];
$headers = ['Content-Type: application/json'];
$response = Http::call('https://api.example.com/data', $params, 'POST', $headers);
echo $response->getBody('array'); // Outputs the response body as an array

Making a GET Request with SSL

<?php
use NsHelpers\Http\Http;
$response = Http::call('https://secure.example.com/data', [], 'GET', [], true);
echo $response->getHttpCode(); // Outputs the HTTP status code

统计信息

  • 总下载量: 39
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-09-08