Search by

rzrasel / library-php-rz-sdk-libs

rzrasel

Library PHP Rz SDK Libs

Package info

github.com/rzrasel/library-php-rz-sdk-libs

pkg:composer/rzrasel/library-php-rz-sdk-libs

Statistics

Installs: 19

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-10-31 18:24 UTC

This package is auto-updated.

Last update: 2026-11-01 08:08:58 UTC


README

A collection of reusable, modular PHP SDK libraries.

PHP Composer License GitHub

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

  1. Introduction
  2. Repository Info
  3. Features
  4. Available Libraries
  5. Requirements
  6. Installation
  7. Composer Configuration
  8. Composer Commands Cheat-Sheet
  9. Autoloading
  10. Usage
  11. Project Structure
  12. Development Setup
  13. Running Tests
  14. Git Workflow
  15. Publishing & Versioning
  16. Security
  17. Contributing
  18. 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:

✨ 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

  1. Fork repo
  2. Clone fork
  3. Create feature branch feat/your-feature
  4. Implement + add tests
  5. Update docs
  6. Commit & push
  7. Submit PR Guidelines:
  • Follow RzSDK\Encryption namespace
  • Keep modules independent
  • Use PSR-4 & Composer autoloading
  • Provide usage examples

πŸ“œ 18. License & Author

License: MIT β€” See LICENSE file. Author: Rz Rasel

RzSDK PHP Libraries β€” Reusable PHP Components. Modular Architecture. Simplified Development. πŸš€