定制 ifo/laravel-base-utilities 二次开发

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

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

ifo/laravel-base-utilities

最新稳定版本:1.0.2

Composer 安装命令:

composer require ifo/laravel-base-utilities

包简介

README 文档

README

bash composer require ifo/laravel-base-utilities

After installation, the package will automatically register itself in your Laravel project.

Configuration To publish the package configuration, run:

php artisan vendor:publish --tag=config

This will create a config/ifobaseutilities.php file where you can customize package settings.

Available Facades The following facades are available for use in your application:

Packages\IfoBaseUtilities\AbstractApiService
Packages\IfoBaseUtilities\AbstractModel
Packages\IfoBaseUtilities\BaseValidator
Packages\IfoBaseUtilities\DecryptRequest
Packages\IfoBaseUtilities\EncryptResponse
Packages\IfoBaseUtilities\HasNotDeletedScope
Packages\IfoBaseUtilities\ResponseService

Usage Here’s how to use each facade in your project:

AbstractApiService Use AbstractApiService to define reusable API service logic.

use Packages\IfoBaseUtilities\AbstractApiService;

$service = new AbstractApiService(); $response = $service→callEndpoint($url, $data);

AbstractModel Use AbstractModel as a base class for your Eloquent models.

use Packages\IfoBaseUtilities\AbstractModel;

class User extends AbstractModel { // Custom logic for the User model }

BaseValidator BaseValidator simplifies validation logic for incoming requests.

use IfoBaseUtilities\BaseValidator;

$rules = [ 'email' ⇒ 'required|email', 'password' ⇒ 'required|min:6', ]; $validator = BaseValidator::validate($data, $rules);

DecryptRequest Use DecryptRequest to decrypt incoming encrypted request payloads.

use IfoBaseUtilities\DecryptRequest;

$decryptedData = DecryptRequest::handle($request→input('data'));

EncryptResponse EncryptResponse is used to encrypt outgoing responses.

use IfoBaseUtilities\EncryptResponse;

$encryptedResponse = EncryptResponse::handle($data); return response()→json($encryptedResponse);

HasNotDeletedScope Use HasNotDeletedScope to include a query scope for models that are not soft deleted.

use IfoBaseUtilities\HasNotDeletedScope;

$query = User::withoutTrashed()→get();

ResponseService Use ResponseService to send standardized API responses.

use IfoBaseUtilities\ResponseService;

return ResponseService::send('Data retrieved successfully', 200, $data);

Advanced Configuration If you need to customize the facades or add additional functionality, you can extend the provided classes in your project.

Support For issues, feel free to open an issue on the GitHub repository or contact support.

License This package is open-source and available under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-11-15