nassiry/laravel-encoder
Composer 安装命令:
composer require nassiry/laravel-encoder
包简介
An advanced Laravel encoder package for string & integer encoding and decoding.
关键字:
README 文档
README
Laravel Encoder Package
The Laravel Encoder package provides a robust and secure way to encode and decode IDs & Strings using customizable Base encoding mechanisms (Base62). With support for variable-length encoding, mappers for added security, and seamless integration with Laravel, this package is ideal for obfuscating sensitive data or creating URL-safe identifiers.
⚠️ Note: This package is meant for obfuscation, not encryption. Do not use it for storing or transmitting sensitive data securely.
Table Of Contents
- Features
- Requirements
- Installation
- Quick Example
- Documentation
- Why I Built This
- Why Base62?
- Why Choose This Package?
- Contributing
- Changelog
- License
Features
- Base Encoding: Supports customizable bases (Base62).
- Variable-Length Encoding: Allows encoding with custom lengths for obfuscation.
- Mapper-Based Obfuscation: Adds an extra layer of security by using configurable prime numbers and mappers.
- Customizable Configuration: Publish the configuration file to override default mappers.
- Exception Handling: Provides detailed exceptions for invalid inputs.
- Laravel Integration: Works seamlessly with Laravel’s service container and configuration system.
- Security: Protects sensitive IDs by ensuring encoded values are not easily reversible without the correct configuration.
Requirements
- PHP 8.1 or higher
- Laravel 10 or higher (optional, for Laravel integration)
- PHP extensions:
bcmath,mbstring
Installation
Step 1: Install via Composer
composer require nassiry/laravel-encoder
Quick Example
use Nassiry\Encoder\Facades\Encoder; $encoded = Encoder::encodeId(12345); $decoded = Encoder::decodeId($encoded); echo $encoded; // Encoded Strings echo $decoded; // 12345
$encoded = Encoder::encodeString('Hello World'); $decoded = Encoder::decodeString($encoded); echo $encoded; // Encoded Strings echo $decoded; // Hello World
Documentation
Laravel Integration
Encode/decode strings and IDs using Laravel container, facades, or dependency injection.
Standalone PHP Usage
Use in any PHP project, no Laravel required.
Configuration
Customize encoding behavior, mappers, and defaults.
Custom Bases
Add your own Base58, Base64, or custom encoders.
Exception Handling
Covers validation, decoding issues, and base errors.
Testing & Contributing
Run the test suite or contribute improvements.
Why I Built This
Laravel's encryption produced long strings, and Base64 needed extra steps to be URL-safe. I wanted a clean, simple way to encode IDs and strings short, URL-safe, and easy to configure.
Full Story & Benefits
Why Base62?
Conclusion: Why Choose This Package?
Contributing
Feel free to submit issues or pull requests to improve the package. Contributions are welcome! Let’s improve it together!
Changelog
See CHANGELOG for release details.
License
This package is open-source software licensed under the MIT license.
nassiry/laravel-encoder 适用场景与选型建议
nassiry/laravel-encoder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 351 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「encoder」 「decoder」 「hashid」 「base62」 「laravel-hashid」 「encode-string」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nassiry/laravel-encoder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nassiry/laravel-encoder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nassiry/laravel-encoder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Hashids for Yii2
Streaming parser to extract tarballs with ReactPHP.
Laravel ID Encrypt Helper
base62 encoder and decoder also for big numbers with Laravel integration
PHP Library for Encoding.com's XML API
Provides hash tools for Laravel.
统计信息
- 总下载量: 351
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-28
