chiroruxx / php-scope-function
Scope functions for PHP.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/chiroruxx/php-scope-function
Requires (Dev)
- phpunit/phpunit: ^9.5.10
This package is auto-updated.
Last update: 2025-09-27 16:20:50 UTC
README
Installation
composer require chiroruxx/php-scope-function
Usage
class User { use \Chiroruxx\ScopeFunction\ScopeFunction; // ... }
let
$user = User::find($id); $json = $user?->let(function (User $it): string { $formatter = new UserFormatter(); return $formatter->formatToJson($it); }); return $json ?? '';
also
$user->also(function (User $it): void { $it->created_at = new DateTime(); $it->updated_at = new DateTime(); }) ->save();