PHPackages                             magnate/magnate - 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. magnate/magnate

ActiveFramework[Framework](/categories/framework)

magnate/magnate
===============

Framework for WordPress plugin development.

0.9.8(4y ago)017GPL-3.0PHPPHP &gt;=7.4.0

Since May 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/magnatefw/magnate)[ Packagist](https://packagist.org/packages/magnate/magnate)[ Docs](https://github.com/magnatefw/magnate)[ RSS](/packages/magnate-magnate/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

Magnate 0.9.8
=============

[](#magnate-098)

TODO
----

[](#todo)

1. Write the docs.
2. Add CSRF-protection.
3. Add field aliases to Active Record.

How to use
----------

[](#how-to-use)

### Entry Point

[](#entry-point)

You can create an entry point class by inheriting **\\Magnate\\EntryPoint**. An entry point class intended for create a singleton that contains all or significant part of the plugin logic.

The init() method can be overrided if you want to add some logic to object construction.

You must create **\\Magnate\\Injectors\\EntryPointInjector** instance before create an entry point object. It is pretty simple: all you need is a root directory and URL of your plugin.

**NOTICE:** The init() method must be protected and return *$this*.

### Migrations

[](#migrations)

You can add migrations class by inheriting **\\Magnate\\Tables\\Migration** with overrided up() method that contains all table creating logic. Table name can be determined by calling the table() method. Call the field() method to add field, the index() method to add index and the entry() method to add an entry to empty table.

**NOTICE:** The up() method must be protected and return *$this*.

### Active Record

[](#active-record)

An AR model can be created by inheriting **\\Magnate\\Tables\\ActiveRecord**. You can get a single model instance by find() method or took a collection of instances by where(), order() or limit() methods.

Example:

```
