abramcatalyst/php-cli-tools
Composer 安装命令:
composer require abramcatalyst/php-cli-tools
包简介
A collection of useful PHP CLI utilities (UUID, Hashing, JWT, Base64, Slugify, Timestamp, Password Generator)
关键字:
README 文档
README
A collection of handy PHP CLI utilities for developers.
Tools
- UUID Generator - Generate UUID v4 (random UUIDs)
- Password Hasher - Hash passwords using bcrypt
- JWT Maker - Create JWT tokens with HS256 algorithm
- Timestamp Converter - Convert between timestamps and human-readable dates
- Base64 Tool - Encode/decode base64 strings
- Slugify Tool - Convert text to URL-friendly slugs
- Random Password Generator - Generate secure random passwords
Requirements
- PHP 7.4 or higher
- Composer
Installation
Install via Composer:
composer require abramcatalyst/php-cli-tools
Or add to your composer.json:
{
"require": {
"abramcatalyst/php-cli-tools": "^1.0"
}
}
Usage
After installation, the CLI tools will be available in vendor/bin/:
# Using vendor/bin directly ./vendor/bin/uuid ./vendor/bin/hash mypassword ./vendor/bin/jwt '{"id":1}' ./vendor/bin/timestamp ./vendor/bin/base64tool encode "Hello" ./vendor/bin/slug "Hello World" ./vendor/bin/password 16
Or if you have Composer's bin directory in your PATH, you can use them directly:
uuid hash mypassword jwt '{"id":1}' timestamp base64tool encode "Hello" slug "Hello World" password 16
UUID Generator
Generate a UUID v4:
vendor/bin/uuid
# Output: 550e8400-e29b-41d4-a716-446655440000
Password Hasher
Hash a password using bcrypt:
vendor/bin/hash mypassword # Output: $2y$10$... # With custom cost (4-31): vendor/bin/hash mypassword 12
JWT Maker
Create a JWT token:
# With default secret vendor/bin/jwt '{"id":1,"name":"John"}' # With custom secret vendor/bin/jwt '{"id":1,"name":"John"}' my-secret-key
Timestamp Converter
Convert timestamps to dates or dates to timestamps:
# Show current timestamp and date vendor/bin/timestamp # Convert timestamp to date vendor/bin/timestamp 1700000000 # Output: 2023-11-14 22:13:20 # Convert date to timestamp vendor/bin/timestamp "2023-11-14 22:13:20" # Output: 1700000000
Base64 Tool
Encode or decode base64:
# Encode vendor/bin/base64tool encode "Hello World" # Output: SGVsbG8gV29ybGQ= # Decode vendor/bin/base64tool decode "SGVsbG8gV29ybGQ=" # Output: Hello World
Slugify Tool
Convert text to a URL-friendly slug:
vendor/bin/slug "Hello World!" # Output: hello-world vendor/bin/slug "This is a Test!!!" # Output: this-is-a-test
Random Password Generator
Generate a secure random password:
# Default length (16 characters) vendor/bin/password # Custom length (1-128 characters) vendor/bin/password 32
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-23