memran / marwa-support
Framework-agnostic PHP support library with typed helpers for strings, arrays, files, objects, validation, and security primitives
Requires
- php: ^8.2
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.66
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^9.6.33
README
Framework-agnostic PHP support utilities for common string, array, file, object, validation, HTML, and security tasks. The package is designed for library and application code that needs small, composable helpers with strict typing and predictable behavior.
Requirements
- PHP 8.2 or newer
- Extensions:
json,mbstring,openssl
Installation
composer require memran/marwa-support
For local development:
composer install
Usage
use Marwa\Support\Crypt; use Marwa\Support\File; use Marwa\Support\Helper; use Marwa\Support\Str; use Marwa\Support\Validation; $slug = Str::slug('Secure Helper Library'); $payload = Crypt::encrypt('secret', $_ENV['APP_KEY']); File::put(__DIR__ . '/storage/example.json', ['slug' => $slug]); $validator = Validation::make( ['user' => ['email' => 'team@example.com']], ['user.email' => 'required|email'] ); if ($validator->fails()) { var_dump($validator->errors()); } $result = Helper::retry(3, fn () => 'ok');
Configuration
The library is mostly configuration-free. Pass secrets such as encryption keys from your application configuration or environment, not from hard-coded strings. For CSRF helpers, call them only in applications that already manage PHP sessions safely.
Testing
composer test
composer test:coverage
Static Analysis
composer analyse composer lint composer fix
phpstan.neon.dist runs analysis on src/ at level 5. .php-cs-fixer.dist.php enforces PSR-12-style formatting with strict typing rules.
CI/CD
GitHub Actions runs Composer validation, coding standards, PHPStan, and PHPUnit on PHP 8.2, 8.3, and 8.4 through .github/workflows/ci.yml.
Contributing
- Install dependencies with
composer install. - Run
composer cibefore opening a pull request. - Add or update PHPUnit coverage for behavior changes.
- Keep commits focused and describe the behavioral impact in the PR.
Repository-specific contributor guidance is available in AGENTS.md.