jyoungblood/dw-utilities
最新稳定版本:0.1
Composer 安装命令:
composer require jyoungblood/dw-utilities
包简介
A collection of utility functions to facilitate an efficient workflow with the Darkwave web application toolkit.
关键字:
README 文档
README
A collection of utility functions to facilitate an efficient workflow with the Darkwave web application toolkit.
Installation
These functions are included with Darkwave, but they can be installed and used as standalone functions in any project.
Install the package with Composer:
composer require jyoungblood/dw-utilities
Then add it to your application:
use Darkwave\dw;
require __DIR__ . '/vendor/autoload.php';
Available Methods
dw::client_ip()
Returns the (best guess for the) current visitor's IP address, using a combination of $_SERVER['HTTP_CLIENT_IP'], $_SERVER['HTTP_X_FORWARDED_FOR'], and $_SERVER['REMOTE_ADDR']
dw::client_ip();
dw::authenticate()
Parses the JWT 'token' cookie and sets global authentication variables to be used by the rest of the application.
dw::authenticate();
dw::generate_jwt($user)
Uses psr-jwt to generate a JWT based on data from a given user's profile. Sets payload claims for _id, name, avatar_url, screenname, admin_token, and staff_token
dw::generate_jwt($user);
dw::convert_image($args)
Uses php-image-resize and GD to convert a given image based on various configuration parameters.
dw::convert_image([ 'source' => $_SERVER['DOCUMENT_ROOT'] . '/uploads/source-filename.jpg', 'target' => $_SERVER['DOCUMENT_ROOT'] . '/uploads/converted-filename.jpg', 'resize' => [300, 300], // 'threshold' => 800 'crop' => 'center', 'quality' => 80 ]);
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-22