{"id":21467446,"url":"https://github.com/elusivecodes/fyreengine","last_synced_at":"2026-03-27T04:25:29.536Z","repository":{"id":57677534,"uuid":"489899281","full_name":"elusivecodes/FyreEngine","owner":"elusivecodes","description":"FyreEngine is a free, open-source engine library for PHP.","archived":false,"fork":false,"pushed_at":"2024-10-18T07:24:55.000Z","size":274,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-18T08:52:05.394Z","etag":null,"topics":["engine","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elusivecodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-08T09:27:35.000Z","updated_at":"2024-10-18T07:24:39.000Z","dependencies_parsed_at":"2024-04-12T12:45:22.098Z","dependency_job_id":"c5efc156-28bd-4664-8d6e-de11158905a8","html_url":"https://github.com/elusivecodes/FyreEngine","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":0.09999999999999998,"last_synced_commit":"c38f99df0243f1f4306c69d0e64fcea62fdbd28b"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreEngine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017554,"owners_count":17560539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["engine","php"],"created_at":"2024-11-23T08:18:07.937Z","updated_at":"2026-03-27T04:25:29.477Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreEngine\r\n\r\n**FyreEngine** is a free, open-source engine library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Basic Usage](#basic-usage)\r\n- [Methods](#methods)\r\n- [Attributes](#attributes)\r\n- [Global Functions](#global-functions)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/engine\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\Engine\\Engine;\r\n```\r\n\r\n\r\n## Basic Usage\r\n\r\n- `$loader` is a [*Loader*](https://github.com/elusivecodes/FyreLoader).\r\n\r\n```php\r\n$engine = new Engine($loader);\r\n```\r\n\r\n\r\n## Methods\r\n\r\nThis class extends the [*Container*](https://github.com/elusivecodes/FyreContainer) class.\r\n\r\n**Boot**\r\n\r\nBoot the application.\r\n\r\n```php\r\n$engine-\u003eboot();\r\n```\r\n\r\n**Middleware**\r\n\r\nBuild application [middleware](https://github.com/elusivecodes/FyreMiddleware).\r\n\r\n- `$queue` is a [*MiddlewareQueue*](https://github.com/elusivecodes/FyreMiddleware#middleware-queues).\r\n\r\n```php\r\n$middleware = $engine-\u003emiddleware($queue);\r\n```\r\n\r\n\r\n## Attributes\r\n\r\nAttributes can be used to provide context when resolving values from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n**Cache**\r\n\r\nLoad a shared [*Cacher*](https://github.com/elusivecodes/FyreCache#cachers) instance.\r\n\r\n```php\r\nuse Fyre\\Cache\\Cacher;\r\nuse Fyre\\Engine\\Attributes\\Cache;\r\n\r\n$engine-\u003ecall(function(#[Cache] Cacher $cache): void { });\r\n$engine-\u003ecall(function(#[Cache('default')] Cacher $cache): void { });\r\n```\r\n\r\n**Config**\r\n\r\nRetrieve a value from the config using \"dot\" notation.\r\n\r\n```php\r\nuse Fyre\\Engine\\Attributes\\Config;\r\n\r\n$engine-\u003ecall(function(#[Config('App.value')] string $value): void { });\r\n```\r\n\r\n**Current User**\r\n\r\nGet the current user.\r\n\r\n```php\r\nuse Fyre\\Engine\\Attributes\\CurrentUser;\r\nuse Fyre\\Entity\\Entity;\r\n\r\n$engine-\u003ecall(function(#[CurrentUser] Entity|null $user): void { });\r\n```\r\n\r\n**DB**\r\n\r\nLoad a shared [*Connection*](https://github.com/elusivecodes/FyreDB#connections) instance.\r\n\r\n```php\r\nuse Fyre\\DB\\Connection;\r\nuse Fyre\\Engine\\Attributes\\DB;\r\n\r\n$engine-\u003ecall(function(#[DB] Connection $connection): void { });\r\n$engine-\u003ecall(function(#[DB('default')] Connection $connection): void { });\r\n```\r\n\r\n**Encryption**\r\n\r\nLoad a shared [*Encrypter*](https://github.com/elusivecodes/FyreEncryption#encrypters) instance.\r\n\r\n```php\r\nuse Fyre\\Encryption\\Encrypter;\r\nuse Fyre\\Engine\\Attributes\\Encryption;\r\n\r\n$engine-\u003ecall(function(#[Encryption] Encrypter $encrypter): void { });\r\n$engine-\u003ecall(function(#[Encryption('default')] Encrypter $encrypter): void { });\r\n```\r\n\r\n**Log**\r\n\r\nLoad a shared [*Logger*](https://github.com/elusivecodes/FyreLog#loggers) instance.\r\n\r\n```php\r\nuse Fyre\\Log\\Logger;\r\nuse Fyre\\Engine\\Attributes\\Log;\r\n\r\n$engine-\u003ecall(function(#[Log] Logger $logger): void { });\r\n$engine-\u003ecall(function(#[Log('default')] Logger $logger): void { });\r\n```\r\n\r\n**Mail**\r\n\r\nLoad a shared [*Mailer*](https://github.com/elusivecodes/FyreMail#mailers) instance.\r\n\r\n```php\r\nuse Fyre\\Mail\\Mailer;\r\nuse Fyre\\Engine\\Attributes\\Mail;\r\n\r\n$engine-\u003ecall(function(#[Mail] Mailer $mailer): void { });\r\n$engine-\u003ecall(function(#[Mail('default')] Mailer $mailer): void { });\r\n```\r\n\r\n**ORM**\r\n\r\nLoad a shared [*Model*](https://github.com/elusivecodes/FyreORM#models) instance.\r\n\r\n```php\r\nuse Fyre\\ORM\\Model;\r\nuse Fyre\\Engine\\Attributes\\ORM;\r\n\r\n$engine-\u003ecall(function(#[ORM] Model $model): void { });\r\n$engine-\u003ecall(function(#[ORM('default')] Model $model): void { });\r\n```\r\n\r\n**Route Argument**\r\n\r\nRetrieve an argument from the loaded route.\r\n\r\n```php\r\nuse Fyre\\Engine\\Attributes\\RouteArgument;\r\n\r\n$engine-\u003ecall(function(#[RouteArgument('id')] int $id): void { });\r\n```\r\n\r\n\r\n## Global Functions\r\n\r\n**__**\r\n\r\nGet a language value.\r\n\r\n- `$key` is a string representing the key to lookup.\r\n- `$data` is an array containing data to insert into the language string.\r\n\r\n```php\r\n$lang = __($key, $data);\r\n```\r\n\r\n**Abort**\r\n\r\nThrow an [*Exception*](https://github.com/elusivecodes/FyreError).\r\n\r\n- `$code` is a number representing the status code, and will default to *500*.\r\n- `$message` is a string representing the error message, and will default to *\"\"*.\r\n\r\n```php\r\nabort($code, $message);\r\n```\r\n\r\n**App**\r\n\r\nLoad a shared *Engine* instance.\r\n\r\n```php\r\n$app = app();\r\n```\r\n\r\nYou can also load other shared class instances.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$arguments` is an array containing the named arguments for the class constructor.\r\n\r\n```php\r\n$instance = app($alias, $arguments);\r\n```\r\n\r\n**Asset**\r\n\r\nGenerate a URL for an asset path.\r\n\r\n- `$path` is a string representing the asset path.\r\n- `$options` is an array containing the route options.\r\n    - `fullBase` is a boolean indicating whether to use the full base URI and will default to *false*.\r\n\r\n```php\r\n$url = asset($path);\r\n```\r\n\r\n**Auth**\r\n\r\nLoad a shared [*Auth*](https://github.com/elusivecodes/FyreAuth) instance.\r\n\r\n```php\r\n$auth = auth();\r\n```\r\n\r\n**Authorize**\r\n\r\nAuthorize an access rule.\r\n\r\n- `$rule` is a string representing the access rule name or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) method.\r\n\r\nAny additional arguments supplied will be passed to the access rule callback or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) method.\r\n\r\n```php\r\nauthorize($rule, ...$args);\r\n```\r\n\r\n**Cache**\r\n\r\nLoad a shared [*Cacher*](https://github.com/elusivecodes/FyreCache) instance.\r\n\r\n- `$key` is a string representing the *Cacher* key, and will default to `Cache::DEFAULT`.\r\n\r\n```php\r\n$cacher = cache($key);\r\n```\r\n\r\n**Can**\r\n\r\nCheck whether an access rule is allowed.\r\n\r\n- `$rule` is a string representing the access rule name or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) method.\r\n\r\nAny additional arguments supplied will be passed to the access rule callback or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) method.\r\n\r\n```php\r\n$result = can($rule, ...$args);\r\n```\r\n\r\n**Can Any**\r\n\r\nCheck whether any access rule is allowed.\r\n\r\n- `$rules` is an array containing access rule names or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) methods.\r\n\r\nAny additional arguments supplied will be passed to the access rule callbacks or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) methods.\r\n\r\n```php\r\n$result = can_any($rules, ...$args);\r\n```\r\n\r\n**Can None**\r\n\r\nCheck whether no access rule is allowed.\r\n\r\n- `$rules` is an array containing access rule names or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) methods.\r\n\r\nAny additional arguments supplied will be passed to the access rule callbacks or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) methods.\r\n\r\n```php\r\n$result = can_none($rule, ...$args);\r\n```\r\n\r\n**Cannot**\r\n\r\nCheck whether an access rule is not allowed.\r\n\r\n- `$rule` is a string representing the access rule name or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) method.\r\n\r\nAny additional arguments supplied will be passed to the access rule callback or [*Policy*](https://github.com/elusivecodes/FyreAuth#policies) method.\r\n\r\n```php\r\n$result = cannot($rule, ...$args);\r\n```\r\n\r\n**Collect**\r\n\r\nCreate a new [*Collection*](https://github.com/elusivecodes/FyreCollection).\r\n\r\n- `$source` can be either an array, a *Closure* that returns a *Generator*, or a *Traversable* or *JsonSerializable* object.\r\n\r\n```php\r\n$collection = collect($source);\r\n```\r\n\r\n**Config**\r\n\r\nLoad a shared [*Config*](https://github.com/elusivecodes/FyreConfig) instance.\r\n\r\n```php\r\n$config = config();\r\n```\r\n\r\nYou can also retrieve a value from the config using \"dot\" notation.\r\n\r\n- `$key` is a string representing the key to lookup.\r\n- `$default` is the default value to return, and will default to *null*.\r\n\r\n```php\r\n$value = config($key, $default);\r\n```\r\n\r\n**DB**\r\n\r\nLoad a shared [*Connection*](https://github.com/elusivecodes/FyreDB#connections) instance.\r\n\r\n- `$key` is a string representing the [*Connection*](https://github.com/elusivecodes/FyreDB#connections) key, and will default to `ConnectionManager::DEFAULT`.\r\n\r\n```php\r\n$connection = db($key);\r\n```\r\n\r\n**DD**\r\n\r\nDump and die.\r\n\r\n```php\r\ndd(...$data);\r\n```\r\n\r\n**Dump**\r\n\r\nDump data.\r\n\r\n```php\r\ndump(...$data);\r\n```\r\n\r\n**Email**\r\n\r\nCreate an [*Email*](https://github.com/elusivecodes/FyreMail#emails).\r\n\r\n- `$key` is a string representing the [*Mailer*](https://github.com/elusivecodes/FyreMail#mailers) key, and will default to *Mail::DEFAULT*.\r\n\r\n```php\r\n$email = email($key);\r\n```\r\n\r\n**Encryption**\r\n\r\nLoad a shared [*Encrypter*](https://github.com/elusivecodes/FyreEncryption#encrypters) instance.\r\n\r\n- `$key` is a string representing the *Encrypter* key, and will default to `Encryption::DEFAULT`.\r\n\r\n```php\r\n$encrypter = encryption($key);\r\n```\r\n\r\n**Env**\r\n\r\nRetrieve an environment variable.\r\n\r\n- `$name` is a string representing the variable name.\r\n- `$default` is the default value to return, and will default to *null*.\r\n\r\n```php\r\n$value = env($name, $default);\r\n```\r\n\r\n**Escape**\r\n\r\nEscape characters in a string for use in HTML.\r\n\r\n- `$string` is the string to escape.\r\n\r\n```php\r\n$escaped = escape($string);\r\n```\r\n\r\n**Json**\r\n\r\nCreate a new [*ClientResponse*](https://github.com/elusivecodes/FyreServer#client-responses) with JSON data.\r\n\r\n- `$data` is the data to send.\r\n\r\n```php\r\n$response = json($data);\r\n```\r\n\r\n**Log Message**\r\n\r\nLog a message.\r\n\r\n- `$type` is a string representing the log level.\r\n- `$message` is a string representing the log message.\r\n- `$data` is an array containing data to insert into the message string.\r\n\r\n```php\r\nlog_message($type, $message, $data);\r\n```\r\n\r\nThe `$type` must be one of the supported [log levels](https://github.com/elusivecodes/FyreLog#logging).\r\n\r\n**Logged In**\r\n\r\nDetermine if the current user is logged in.\r\n\r\n```php\r\n$loggedIn = logged_in();\r\n```\r\n\r\n**Model**\r\n\r\nLoad a shared [*Model*](https://github.com/elusivecodes/FyreORM#models) instance.\r\n\r\n- `$alias` is a string representing the model alias.\r\n\r\n```php\r\n$model = model($alias);\r\n```\r\n\r\n**Now**\r\n\r\nCreate a new [*DateTime*](https://github.com/elusivecodes/FyreDateTime) set to now.\r\n\r\n```php\r\n$now = now();\r\n```\r\n\r\n**Queue**\r\n\r\nPush a job to a [*Queue*](https://github.com/elusivecodes/FyreQueue#queues).\r\n\r\n- `$className` is a string representing the job class.\r\n- `$arguments` is an array containing arguments that will be passed to the job.\r\n- `$options` is an array containing options for the [*Message*](#messages).\r\n    - `config` is a string representing the configuration key, and will default to \"*default*\".\r\n    - `queue` is a string representing the [*Queue*](#queues) name, and will default to \"*default*\".\r\n    - `method` is a string representing the class method, and will default to \"*run*\".\r\n    - `delay` is a number representing the number of seconds before the job should run, and will default to *0*.\r\n    - `expires` is a number representing the number of seconds after which the job will expire, and will default to *0*.\r\n\r\n```php\r\nqueue($className, $arguments, $options);\r\n```\r\n\r\n**Redirect**\r\n\r\nCreate a new [*RedirectResponse*](https://github.com/elusivecodes/FyreServer#redirect-responses).\r\n\r\n- `$uri` is a [*Uri*](https://github.com/elusivecodes/FyreURI) or string representing the URI to redirect to.\r\n- `$code` is a number representing the header status code, and will default to *302*.\r\n- `$options` is an array containing configuration options.\r\n\r\n```php\r\n$response = redirect($uri, $code, $options);\r\n```\r\n\r\n**Request**\r\n\r\nLoad a shared [*ServerRequest*](https://github.com/elusivecodes/FyreServer#server-requests) instance.\r\n\r\n```php\r\n$request = request();\r\n```\r\n\r\nYou can also retrieve value from the `$_POST` array by passing arguments to this function.\r\n\r\n- `$key` is a string representing the array key using \"dot\" notation.\r\n- `$as` is a string representing the value type, and will default to *null*.\r\n\r\n```php\r\n$value = request($key, $as);\r\n```\r\n\r\n**Response**\r\n\r\nCreate a new [*ClientResponse*](https://github.com/elusivecodes/FyreServer#client-responses).\r\n\r\n```php\r\n$response = response();\r\n```\r\n\r\n**Route**\r\n\r\nGenerate a URL for a named [*Route*](https://github.com/elusivecodes/FyreRouter).\r\n\r\n- `$name` is a string representing the route alias.\r\n- `$arguments` is an array containing the route arguments.\r\n    - `?` is an array containing route query parameters.\r\n    - `#` is a string representing the fragment component of the URI.\r\n- `$options` is an array containing the route options.\r\n    - `fullBase` is a boolean indicating whether to use the full base URI and will default to *false*.\r\n\r\n```php\r\n$route = route($name, $arguments, $options);\r\n```\r\n\r\n**Session**\r\n\r\nLoad a shared [*Session*](https://github.com/elusivecodes/FyreSession) instance.\r\n\r\n```php\r\n$session = session();\r\n```\r\n\r\nRetrieve a value from the session.\r\n\r\n- `$key` is a string representing the session key.\r\n\r\n```php\r\n$value = session($key);\r\n```\r\n\r\nYou can also set a session value by including a second argument.\r\n\r\n```php\r\nsession($key, $value);\r\n```\r\n\r\n**Type**\r\n\r\nLoad a shared [*TypeParser*](https://github.com/elusivecodes/FyreTypeParser) instance.\r\n\r\n```php\r\n$parser = type();\r\n```\r\n\r\nYou can also get the mapped [*Type*](https://github.com/elusivecodes/FyreTypeParser#types) class for a value type.\r\n\r\n- `$type` is a string representing the value type.\r\n\r\n```php\r\n$typeClass = type($type);\r\n```\r\n\r\n**User**\r\n\r\nGet the current user.\r\n\r\n```php\r\n$user = user();\r\n```\r\n\r\n**View**\r\n\r\nRender a [*View*](https://github.com/elusivecodes/FyreView) template.\r\n\r\n- `$template` is a string representing the template file.\r\n- `$data` is an array containing data to pass to the template.\r\n- `$layout` is a string representing the layout file, and will default to *null*.\r\n\r\n```php\r\n$view = view($template, $data, $layout);\r\n```\r\n\r\nIf the `$layout` is set to null, it will use the `App.defaultLayout` option from the *Config*.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyreengine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyreengine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyreengine/lists"}