amiminn/support

laravel 支持系统

v0.0.1 2024-03-19 05:25 UTC

This package is auto-updated.

Last update: 2024-09-16 10:29:38 UTC


README

我制作的一些助手,用于帮助我自己的laravel项目 @amiminn

安装

使用包管理器composer进行安装

composer require amiminn/support

设置(可选)

config/app.php 中添加类

/* package service provider */
Amiminn\Support\Config\App::class,

运行 artisan publish

php artisan vendor:publish --tag=public

用法

响应

use Amiminn\Support\Response;

Response::success($msg);
Response::failed($msg, $status=400);
Response::data($data);
Response::random($num=40);
Response::epoch();
Response::url($path);
Response::user();
Response::uuid();
Response::to_lower($string);

HttpService

use Amiminn\Support\HttpService;

HttpService::get($url, $header=[]);
HttpService::post($url, $data, $header=[]);

FileService

use Amiminn\Support\FileService;

FileService::saveOnetoAsset($req, $name, $path);
FileService::saveMultitoAsset($req, $name, $path);

EmailService

use Amiminn\Support\EmailService;

EmailService::send($email_tujuan, $subject, $path, $data = [], $files = []);

CacheService

use Amiminn\Support\CacheService;

CacheService::put($name, $data = [], $minutes = 10);
CacheService::delete($name);
CacheService::reset();