kaiseki / laravel-helper-mocks
Mock laravel helper functions
Package info
github.com/kaisekidev/kaiseki-laravel-helper-mocks
pkg:composer/kaiseki/laravel-helper-mocks
Requires
- php: ^8.2
- kaiseki/config: ^2.0
- psr/container: ^1.1 || ^2.0
Requires (Dev)
- bnf/phpstan-psr-container: ^1.1
- kaiseki/php-coding-standard: ^1.0
- maglnet/composer-require-checker: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2026-06-02 23:43:56 UTC
README
Mock Laravel helper functions so packages that depend on them can run in non-Laravel projects.
Provides minimal global app(), resolve() and config() functions backed by a PSR-11 container
(read from the global $container), so code written against Laravel's helpers works without pulling
in the Laravel framework.
Installation
composer require kaiseki/laravel-helper-mocks
Requires PHP 8.2 or newer.
Usage
The helpers resolve services from a PSR-11 container exposed as the global $container. Assign it
once during bootstrap:
use Psr\Container\ContainerInterface; /** @var ContainerInterface $myContainer */ global $container; $container = $myContainer;
The mocked helpers are then available globally:
$container = app(); // the container itself $service = app(MyService::class); // a service resolved from the container $same = resolve(MyService::class); $value = config('some.config.key');
app()— returns the container, or a service from it when given an id;nullif no PSR container is set.resolve()— alias ofapp().config()— reads a key throughkaiseki/config(Config::softGet()), returningnullwhen unset.
Each function is declared behind a function_exists() guard, so it yields to a real Laravel
installation if one is present.
Development
composer install
composer check # check-deps, cs-check, phpstan
License
MIT — see LICENSE.