Global helper functions for the Codemonster PHP ecosystem.

Installs: 8

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/codemonster-ru/support

v1.0.0 2025-10-28 16:36 UTC

This package is auto-updated.

Last update: 2025-10-28 16:40:56 UTC


README

Latest Version on Packagist Total Downloads License Tests

Global helper functions for the Codemonster PHP ecosystem.

πŸ“¦ Installation

composer require codemonster-ru/support

🧩 Provided Helpers

Function Description
config() Get or set configuration values
env() Read environment variables
view() / render() Render or return a view instance
router() / route() Access router instance
request() Get the current HTTP request
response() Create a new HTTP response
json() Return a JSON response
session() Read, write, or access session store
dump() / dd() Debugging utilities (print and exit)

πŸš€ Usage

All helpers are automatically registered via Composer’s autoloading. You can call them from anywhere in your application.

<?php

require __DIR__ . '/vendor/autoload.php';

// Environment variables
$value = env('APP_ENV', 'production');

// Configuration
config(['app.name' => 'Codemonster']);

echo config('app.name'); // Codemonster

// HTTP request and response
$request = request();
$response = response('Hello World', 200);
$response->send();

// Router
router()->get('/', fn() => response('Home'));
router()->post('/contact', fn() => response('Contact form submitted'));

// View rendering
echo render('emails.welcome', ['user' => 'Vasya']);

// Debugging
dump($request);
dd('Goodbye');

πŸ§ͺ Testing

You can run tests with the command:

composer test

πŸ‘¨β€πŸ’» Author

Kirill Kolesnikov

πŸ“œ License

MIT