{"id":15296512,"url":"https://github.com/pyxol/magnetar","last_synced_at":"2026-01-05T18:03:45.806Z","repository":{"id":147109531,"uuid":"11955720","full_name":"pyxol/magnetar","owner":"pyxol","description":"Magnetar is a web application framework that focuses on speed and ease of use.","archived":false,"fork":false,"pushed_at":"2024-01-18T21:59:35.000Z","size":9335,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T05:27:15.025Z","etag":null,"topics":["cache","framework","mariadb","php","php81","template-engine"],"latest_commit_sha":null,"homepage":"https://pyxol.com/","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/pyxol.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":"2013-08-07T17:14:21.000Z","updated_at":"2024-01-30T20:44:18.000Z","dependencies_parsed_at":"2023-07-04T05:31:50.450Z","dependency_job_id":"a184b8bc-2d52-4ff6-991a-1d790193f1f6","html_url":"https://github.com/pyxol/magnetar","commit_stats":null,"previous_names":["pyxol/magnetar"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyxol%2Fmagnetar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyxol%2Fmagnetar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyxol%2Fmagnetar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyxol%2Fmagnetar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyxol","download_url":"https://codeload.github.com/pyxol/magnetar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245407763,"owners_count":20610232,"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":["cache","framework","mariadb","php","php81","template-engine"],"created_at":"2024-09-30T18:11:01.889Z","updated_at":"2026-01-05T18:03:40.774Z","avatar_url":"https://github.com/pyxol.png","language":"PHP","readme":"# Magnetar\n\nMagnetar is a web application framework that focuses on speed and ease of use.\n\nTo get started, check out the [Pulsar](https://www.github.com/pyxol/pulsar) starter application.\n\n## Features\n\n- **Dependecy Injection Container** is the core of Magnetar's framework. It manages global instances and automatically resolves injected dependencies in your classes.\n- **Facades** give developers easy access to internal tools through static classes without having to manage instances or resolve dependencies.\n- **Service Providers** provide dynamic configuration and wiring of services.\n- **Models** are predictable data structures that interact with the database\n- **Routing** processes incoming requests and directs them to the appropriate controller.\n- **Controllers** uses a request to generate return responses.\n\n## Kernels\n\nMagnetar is designed from the ground up to be a multi-interface framework. Kernels handle the various ways of interfacing with the application. The **HTTP Kernel** processes incoming HTTP requests and the **Console Kernel** handles CLI requests. Kernels allows developers to use the same codebase for every interface of your application for code uniformity and predictability.\n\n## Themes\n\nThemes provide a web frontend to your application and are stored in the `themes/` directory in the root of your application. \n\nMagnetar implements a no-nonsense approach to template files. PHP is already an amazing templating engine so template files are purely PHP-based. With Magnetar themes, there is no need to learn arbitrary templating languages or syntaxes, no complex template file caching to deal with by default, and there isn't a faster PHP-based templating engine than raw PHP.\n\nUsage of template files in themes is simple:\n\n```php\n// renders themes/my_theme/template_name.php\nTheme::tpl('template_name', [\n\t'var' =\u003e 'value'\n]);\n```\n\nIn the template file, you have access to the contextualized variables passed to the template:\n\n```php\n\u003cp\u003eI am a template. My variable is: \u003c?=esc_html( $this-\u003evar );?\u003e\u003c/p\u003e\n```\n\nWe provide a few global functions to make rendering templates easier. Some of these functions include: `display_tpl()` to embed another template, `esc_attr()` to safely escape a string in an HTML attribute, and `esc_html()` to safely escape a string for use everywhere else in HTML.\n\nYou can also render another template file from within a template file, with our without contextual variables.\n\n```php\n// themes/my_theme/frontpage.php\n\u003c?php\n\t$this-\u003edisplay_tpl('header');   // 'var' is passed to this template\n?\u003e\n\n\u003cp\u003eI am a template. My variable is: \u003c?=esc_html( $this-\u003evar );?\u003e\u003c/p\u003e\n\n\u003c?php\n\tdisplay_tpl('footer');   // contextual variable 'var' is NOT passed to this template\n```\n\nA different theme can be rendered anywhere in your application depending on your needs. If an endpoint in your controller decides to use a different theme, you can use:\n\n```php\n// renders themes/different_theme/template_name.php\nTheme::theme('different_theme')-\u003etpl('template_name', [\n\t'var' =\u003e 'value'\n]);\n```\n\n## Adapters\n\n### Databases\n\nDrivers for **MySQL** / **MariaDB**, **PostgreSQL**, and **SQLite** are included by default. Fetching data from the database is as easy as using:\n\n**Query Builder:**\n```php\n$results = DB::table('table')-\u003ewhere('id', 1)-\u003efetch();\n```\n\n**Quick query methods:**\n```php\n$results = DB::get_rows(\"SELECT * FROM `table` WHERE `id` = :id\", ['id' =\u003e 1]);\n```\n\n### Cache\n\nCache drivers for **Memcached** and **Redis** are available. Fetching cached data and resolving missing cache is as easy as using:\n\n```php\n$cached_value = Cache::get('key', fn () =\u003e {\n\treturn 'value';\n});\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyxol%2Fmagnetar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyxol%2Fmagnetar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyxol%2Fmagnetar/lists"}