rzrasel / library-php-rz-sdk-libs
Library PHP Rz SDK Libs
Package info
github.com/rzrasel/library-php-rz-sdk-libs
pkg:composer/rzrasel/library-php-rz-sdk-libs
Requires
- php: >=8.2
- ext-json: *
- ext-openssl: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-01 08:08:58 UTC
README
A collection of reusable, modular PHP SDK libraries.
RzSDK PHP Libraries β A modular, reusable PHP SDK workspace providing secure encryption components, JWT token management, and extensible libraries for modern PHP 8.2+ applications.
Keywords: PHP SDK, PHP Library, Encryption, JWT, OpenSSL, Security, PSR-4, Composer Package, Reusable Components
RzSDK PHP Libraries Workspace is an open-source, MIT-licensed modular PHP library collection for PHP 8.2+. Built on object-oriented principles and Composer package management, it provides independent, testable modules. The initial data-encryption module offers complete JWT authentication flow, HMAC algorithm support, cipher definitions, and secure secret generation using ext-openssl and ext-json. Ideal for APIs, stateless authentication, and secure application communication. Fully documented with examples, autoloading via vendor/autoload.php, and ready for Packagist distribution.
GitHub Repository: https://github.com/rzrasel/library-php-rz-sdk-libs
Installation composer.json
{
"require": {
"rzrasel/library-php-rz-sdk-libs": "dev-master"
}
}
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rzrasel/library-php-rz-sdk-libs"
}
],
"require": {
"rzrasel/library-php-rz-sdk-libs": "dev-master"
}
}
A collection of reusable, modular PHP SDK libraries β built for modern PHP 8.2+ applications.
π Short Description (for GitHub / Packagist)
RzSDK PHP Libraries Workspace β Modular, reusable PHP SDK providing secure encryption utilities, JWT management, cipher & secret generation for PHP 8.2+ apps.
π Long Description (SEO / Packagist Long Description)
RzSDK PHP Libraries Workspace is an open-source, γentity-MITΒ¦canonical_name=MITγ-licensed modular PHP library collection for PHP 8.2+. Built on OOP, PSR-4 autoloading and Composer package management, it provides independent, testable modules.
The initial data-encryption module offers complete JWT authentication flow (JwtManager, TokenPayload), HMAC algorithm support (JwtAlgorithmType: HS256/HS384/HS512), cipher definitions (CipherType), encryption types (EncryptionType, TokenType), IV/digest utilities (McryptCipherIvGenerator) and secure secret generation (SecretGenerator) using ext-openssl and ext-json.
Ideal for APIs, stateless authentication, microservices and secure application communication. Fully documented with examples, autoloading via vendor/autoload.php, and ready for Packagist distribution.
π SEO / Packagist Keywords
php-sdk, php-library, php8, php82, rzsdk, rzrasel, encryption, jwt, json-web-token, openssl, hmac, hs256, hs384, hs512, cipher, secret-generator, security, authentication, api-auth, psr-4, composer-package, reusable-components, modular-php
π¦ Packagist / GitHub Details
| Property | Details |
|---|---|
| Package Name | rzrasel/library-php-rz-sdk-libs |
| Repository | https://github.com/rzrasel/library-php-rz-sdk-libs |
| Clone URL | https://github.com/rzrasel/library-php-rz-sdk-libs.git |
| Owner | rzrasel |
| Branch | master |
| Visibility | Public |
| License | MIT |
| Language | PHP 8.2+ |
| Packagist | https://packagist.org/packages/rzrasel/library-php-rz-sdk-libs |
| Type | Modular PHP Library Workspace |
| Autoloading | PSR-4 RzSDK\Encryption |
π Table of Contents
- Introduction
- Repository Info
- Features
- Available Libraries
- Requirements
- Installation
- Composer Configuration
- Composer Commands Cheat-Sheet
- Autoloading
- Usage
- Project Structure
- Development Setup
- Running Tests
- Git Workflow
- Publishing & Versioning
- Security
- Contributing
- License & Author
π 1. Introduction
RzSDK PHP Libraries is a modular SDK workspace to provide reusable PHP components across projects without code duplication. Each library has its own:
- β
composer.json - β
src/with PSR-4 Namespace - β
README.md+examples/ - β
tests/(PHPUnit 11) - β Independent dependencies Design Principles:
- π§± Modular architecture
- π§ Object-oriented PHP
- π¦ Composer package management
- π PSR-4 autoloading
- π·οΈ Namespace-based organization
- β»οΈ Reusable & maintainable
ποΈ 2. Repository Information
git clone https://github.com/rzrasel/library-php-rz-sdk-libs.git
cd library-php-rz-sdk-libs
Links:
- γentity-GitHubΒ¦canonical_name=GitHubγ: https://github.com/rzrasel/library-php-rz-sdk-libs
- Packagist: https://packagist.org/packages/rzrasel/library-php-rz-sdk-libs
- Author: https://github.com/rzrasel
β¨ 3. Features
Current Capabilities
- π JWT token management (
JwtManager) - π JWT payload handling (
TokenPayload) - π JWT Algorithm definitions (
JwtAlgorithmType: HS256, HS384, HS512) - 𧬠Cipher type definitions (
CipherType) - π‘οΈ Encryption type definitions (
EncryptionType,TokenType) - π’ Secret generation (
SecretGenerator) - π IV & Digest utilities (
McryptCipherIvGenerator)
Development Features
- Composer path repository for local dev
- Independent module docs
- PHPUnit 11 testing support
- Git automation scripts
π¦ 4. Available Libraries
4.1 data-encryption
Namespace: RzSDK\Encryption
| Component | Description |
|---|---|
JwtManager |
Create, verify & decode JWT tokens |
TokenPayload |
JWT payload representation |
JwtAlgorithmType |
HMAC algorithms HS256/HS384/HS512 |
TokenType |
Token type definitions |
CipherType |
OpenSSL cipher definitions |
EncryptionType |
Encryption mechanism types |
McryptCipherIvGenerator |
IV & digest helpers |
SecretGenerator |
Secure random secret generation |
Module Docs: data-encryption/README.md |
βοΈ 5. Requirements
| Requirement | Version |
|---|---|
| PHP | 8.2 or higher |
| Composer | 2.x recommended |
| ext-openssl | Required |
| ext-json | Required |
| PHPUnit | 11.x for testing |
| Check: |
php -v php -m | grep -E "openssl|json"
πΎ 6. Installation
6.1 Via Packagist (recommended)
Stable (when tagged):
composer require rzrasel/library-php-rz-sdk-libs
Dev branch (current master):
composer require rzrasel/library-php-rz-sdk-libs:dev-master
With source preference (to inspect source):
composer require rzrasel/library-php-rz-sdk-libs:dev-master --prefer-source
With dist preference (faster):
composer require rzrasel/library-php-rz-sdk-libs --prefer-dist
6.2 Clone from GitHub (for development)
git clone https://github.com/rzrasel/library-php-rz-sdk-libs.git
cd library-php-rz-sdk-libs
composer install
6.3 Using in composer.json directly
Simple require:
{
"require": {
"rzrasel/library-php-rz-sdk-libs": "dev-master"
}
}
With VCS repository (if Packagist not updated):
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rzrasel/library-php-rz-sdk-libs"
}
],
"require": {
"rzrasel/library-php-rz-sdk-libs": "dev-master"
}
}
π§ 7. Composer Configuration
7.1 Root Workspace Configuration
The root composer.json uses path repository:
{
"repositories": [
{
"type": "path",
"url": "data-encryption",
"options": { "symlink": true }
}
]
}
7.2 Individual Module Configuration
Each module data-encryption/composer.json defines its own:
- name, description, PHP requirement
- PSR-4 autoload:
"RzSDK\\Encryption\\": "src/" - dev dependencies & test scripts
π 8. Composer Commands Cheat-Sheet
Install package:
composer require rzrasel/library-php-rz-sdk-libs composer require rzrasel/library-php-rz-sdk-libs:dev-master composer require rzrasel/library-php-rz-sdk-libs:dev-master --prefer-source
Show package info (verbose):
composer show rzrasel/library-php-rz-sdk-libs -v composer show rzrasel/library-php-rz-sdk-libs --all
Clear cache & clean vendor:
composer clear-cache composer clearcache rm -rf vendor # Windows PowerShell: # Remove-Item -Recurse -Force vendor
Update & dump autoload:
composer update --no-cache --prefer-source composer update --no-cache composer update rzrasel/library-php-rz-sdk-libs --prefer-source composer update rzrasel/library-php-rz-sdk-libs --prefer-dist composer dump-autoload composer dump-autoload -o
Install all dependencies:
composer install composer install --prefer-source
Remove package:
composer remove rzrasel/library-php-rz-sdk-libs
π 9. Autoloading
Composer generates vendor/autoload.php:
<?php require_once __DIR__ . '/vendor/autoload.php'; use RzSDK\Encryption\JwtManager; use RzSDK\Encryption\TokenPayload; use RzSDK\Encryption\JwtAlgorithmType; use RzSDK\Encryption\CipherType;
PSR-4: RzSDK\Encryption\ => src/
π‘ 10. Usage
10.1 Basic Composer Usage
<?php require_once __DIR__ . '/vendor/autoload.php'; use RzSDK\Encryption\JwtManager;
10.2 JWT Token Management
<?php require_once __DIR__ . '/vendor/autoload.php'; use RzSDK\Encryption\JwtManager; $secretKey = getenv('APP_JWT_SECRET'); if (!$secretKey) { throw new RuntimeException('JWT secret is not configured.'); } $jwtManager = new JwtManager($secretKey); $payload = [ 'user_id' => 1001, 'username' => 'rzrasel', 'iat' => time(), 'exp' => time() + 3600 ]; // Generate token $token = $jwtManager->createToken($payload); echo $token . PHP_EOL; // Verify / Decode (method name per implementation) $decoded = $jwtManager->verifyToken($token); // or $jwtManager->decodeToken($token); print_r($decoded);
10.3 JWT Algorithm Types
use RzSDK\Encryption\JwtAlgorithmType; // HS256 => SHA-256 // HS384 => SHA-384 // HS512 => SHA-512 $alg = JwtAlgorithmType::HS256; // or $alg = JwtAlgorithmType::from('HS256');
| Algorithm | Hash |
|---|---|
| HS256 | SHA-256 |
| HS384 | SHA-384 |
| HS512 | SHA-512 |
10.4 Cipher Types & Encryption Types
use RzSDK\Encryption\CipherType; use RzSDK\Encryption\EncryptionType; use RzSDK\Encryption\TokenType; $cipher = CipherType::AES_256_CBC; // example enum $encType = EncryptionType::OPENSSL;
10.5 Secret Generation
use RzSDK\Encryption\SecretGenerator; $secret = SecretGenerator::generate(64); // 64 chars / bytes per impl echo $secret; $jwtSecret = SecretGenerator::generateJwtSecret(); // if available
10.6 IV & Digest Utilities
use RzSDK\Encryption\McryptCipherIvGenerator; $iv = McryptCipherIvGenerator::generateIv('aes-256-cbc'); $digest = McryptCipherIvGenerator::createDigest('sha256', 'my-data');
10.7 Using TokenPayload Object
use RzSDK\Encryption\TokenPayload; $payloadObj = new TokenPayload([ 'sub' => '1234567890', 'name' => 'Rasel', 'admin' => true ]); $token = $jwtManager->createToken($payloadObj->toArray());
Note: Always check current class signatures in
data-encryption/src/and module README for exact method names.
ποΈ 11. Project Structure
Full Repository Structure (at once)
library-php-rz-sdk-libs/
βββ .gitignore
βββ composer.json # Root workspace composer (path repo to data-encryption)
βββ composer-v1.0.0.json # Historical v1.0.0 composer snapshot
βββ README.md # Main workspace documentation
βββ TEST.md
βββ Git Auto Commit All - v-1.1.3.bat # Windows git automation
βββ Git Auto Commit All - v-1.1.3.command # macOS git automation
βββ Git Bash - v-1.1.3.sh # Bash git automation
β
βββ data-encryption/ # Module: Data Encryption
βββ composer.json # Module composer (package name: rzrasel/library-php-rz-sdk-libs)
βββ README.md # Module-level documentation
βββ phpunit.xml
βββ src/
β βββ JwtManager/
β β βββ JwtManager.php # JWT create/verify/decode
β β βββ TokenPayload.php # Payload DTO
β βββ Type/
β β βββ CipherType.php
β β βββ EncryptionType.php
β β βββ JwtAlgorithmType.php
β β βββ TokenType.php
β βββ Utils/
β βββ McryptCipherIvGenerator.php
β βββ SecretGenerator.php
βββ tests/ # PHPUnit tests
β βββ ...
βββ examples/
βββ jwt-example.php
Future Expansion Design
library-php-rz-sdk-libs/
βββ data-encryption/
βββ database/ # future
βββ validation/ # future
βββ http-client/ # future
βββ file-manager/ # future
βββ ...
Each future module follows same standard: composer.json, README.md, src/, tests/, examples/.
π¨βπ» 12. Development Setup
git clone https://github.com/rzrasel/library-php-rz-sdk-libs.git cd library-php-rz-sdk-libs # Install workspace deps composer install # Install module deps cd data-encryption composer install # Back to root and dump autoload cd .. composer dump-autoload
π§ͺ 13. Running Tests
cd data-encryption composer install composer test # or vendor/bin/phpunit -c phpunit.xml # From workspace root: vendor/bin/phpunit -c data-encryption/phpunit.xml
πΏ 14. Git Workflow
| Script | Platform |
|---|---|
Git Auto Commit All - v-1.1.3.bat |
Windows |
Git Auto Commit All - v-1.1.3.command |
macOS |
Git Bash - v-1.1.3.sh |
Bash |
| Basic commands: |
git status git add . git commit -m "feat: add encryption utils" git pull git push
Automation scripts prompt for commit message + timestamp, then stage/commit/pull/push.
π·οΈ 15. Publishing and Versioning
# Create annotated tag git tag -a v1.0.0 -m "Initial stable release" git push origin v1.0.0 # View tags git tag # Install tagged version in project composer require rzrasel/library-php-rz-sdk-libs:^1.0
Dev version always:
composer require rzrasel/library-php-rz-sdk-libs:dev-master
π 16. Security Considerations
- Never hardcode secrets β use env
APP_JWT_SECRET - Use strong keys (256-bit+)
- Validate JWT signature, exp, iss, aud before trusting claims
- Use authenticated encryption (AES-GCM/CBC + HMAC)
- Keep PHP & OpenSSL updated
- This lib provides utilities; passing tests β security audit. Review before production.
π€ 17. Contributing
- Fork repo
- Clone fork
- Create feature branch
feat/your-feature - Implement + add tests
- Update docs
- Commit & push
- Submit PR Guidelines:
- Follow
RzSDK\Encryptionnamespace - Keep modules independent
- Use PSR-4 & Composer autoloading
- Provide usage examples
π 18. License & Author
License: MIT β See LICENSE file. Author: Rz Rasel
- GitHub: https://github.com/rzrasel
- Repo: https://github.com/rzrasel/library-php-rz-sdk-libs
- Packagist: https://packagist.org/packages/rzrasel/library-php-rz-sdk-libs
RzSDK PHP Libraries β Reusable PHP Components. Modular Architecture. Simplified Development. π