PHPackages                             pyxol/magnetar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. pyxol/magnetar

ActiveLibrary[Framework](/categories/framework)

pyxol/magnetar
==============

Magnetar is a web application framework that focuses on speed and ease of use.

v0.4.1(2y ago)1801MITPHPPHP ^8.1

Since Jul 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pyxol/magnetar)[ Packagist](https://packagist.org/packages/pyxol/magnetar)[ Docs](https://pyxol.com)[ RSS](/packages/pyxol-magnetar/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (5)Versions (19)Used By (1)

Magnetar
========

[](#magnetar)

Magnetar is a web application framework that focuses on speed and ease of use.

To get started, check out the [Pulsar](https://www.github.com/pyxol/pulsar) starter application.

Features
--------

[](#features)

- **Dependecy Injection Container** is the core of Magnetar's framework. It manages global instances and automatically resolves injected dependencies in your classes.
- **Facades** give developers easy access to internal tools through static classes without having to manage instances or resolve dependencies.
- **Service Providers** provide dynamic configuration and wiring of services.
- **Models** are predictable data structures that interact with the database
- **Routing** processes incoming requests and directs them to the appropriate controller.
- **Controllers** uses a request to generate return responses.

Kernels
-------

[](#kernels)

Magnetar 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.

Themes
------

[](#themes)

Themes provide a web frontend to your application and are stored in the `themes/` directory in the root of your application.

Magnetar 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.

Usage of template files in themes is simple:

```
// renders themes/my_theme/template_name.php
Theme::tpl('template_name', [
	'var' => 'value'
]);
```

In the template file, you have access to the contextualized variables passed to the template:

```
I am a template. My variable is:
```

We 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.

You can also render another template file from within a template file, with our without contextual variables.

```
// themes/my_theme/frontpage.php
