PHPackages                             dneustadt/majima - 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. dneustadt/majima

ActiveProject[Framework](/categories/framework)

dneustadt/majima
================

majima is a lightweight PHP framework

0.1.0(8y ago)5282MITPHP

Since Sep 6Pushed 8y ago2 watchersCompare

[ Source](https://github.com/dneustadt/majima)[ Packagist](https://packagist.org/packages/dneustadt/majima)[ Docs](http://softcoder.de)[ RSS](/packages/dneustadt-majima/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (12)Versions (2)Used By (0)

majima
======

[](#majima)

[![Scrutinizer](https://camo.githubusercontent.com/ed8c4c80abf3f594941432c9ae9432626789bd4105a6fc1c481aa92eaa7e7de6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646e657573746164742f6d616a696d612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dneustadt/majima/?branch=master)[![Join the chat at https://gitter.im/majima-framework/Lobby](https://camo.githubusercontent.com/36ad1e6dcfb08fc88f7c42fa86f557423ca510569507f2336b4550492aefa18f/68747470733a2f2f6261646765732e6769747465722e696d2f6d616a696d612d6672616d65776f726b2f4c6f6262792e737667)](https://gitter.im/majima-framework/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

- **License**: MIT
- **Github Repository**:

majima is a lightweight PHP framework that is based on [Symfony](https://github.com/symfony/symfony)components. It features a plugin system that relies heavily on the concept of dependency injection and should suffice as a foundation for most web applications.

### Features

[](#features)

- Plugin System
    - Template inheritance
    - Collectors for JS and LESS compiling
    - install and update routines
- Template Engine
    - functions for inheriting, routing and asset linking
    - HTML bootstrap template
- Query Builder
- User Provider

### Server requirements

[](#server-requirements)

- PHP 5.6.4 or above
- [Apache 2.2 or 2.4](https://httpd.apache.org/)
- Apache's `mod_rewrite` module
- MySQL 5.5.0 or above

#### Required PHP extensions

[](#required-php-extensions)

- [json](http://php.net/manual/en/book.json.php)
- [mbstring](http://php.net/manual/en/book.mbstring.php)
- [session](http://php.net/manual/en/book.session.php)
- [PDO/MySQL](http://php.net/manual/en/ref.pdo-mysql.php)

### Installation

[](#installation)

1.) Clone the git repository to the desired location using:

```
git clone https://github.com/dneustadt/majima.git

```

or use composer

```
composer require dneustadt/majima

```

2.) Set the correct directory permissions:

```
chmod -R 755 var
chmod -R 755 web
chmod -R 755 upload

```

3.) Install dependencies from the same directory

```
composer install

```

4.) Create a new MySQL database

5.) Run the majima installation script by accessing the URL in a web browser. This should be the URL where you uploaded the majima files.

- If you installed majima in the root directory, you should visit: `http://example.com/install`
- If you installed majima in its own subdirectory called `majima`, for example, you should visit: `http://example.com/majima/install`

### Plugins

[](#plugins)

**For a real life examples see the demo plugins:**

-
-

To create a new plugin first make a new directory under the `plugins` directory. In this example it will be `MyPlugin`. Create a new class `MyPlugin.php` within that new directory. The name of the file must match the name of the containing folder.

By extending `PluginAbstract` you will gain access to the `ContainerBuilder` reference

```
$this->container // returns instance of ContainerBuilder

```

#### Example of a Plugin class:

[](#example-of-a-plugin-class)

```
namespace Plugins\MyPlugin;

class MyPlugin extends PluginAbstract
{
    private $priority = 0;

    private $version = '1.0.0';

    public function getPriority()
    {
        return $this->priority;
    }
```

Return an integer for the priority in which order plugins should be loaded. default is 1

```
    public function getVersion()
    {
        return $this->version;
    }
```

Returns the version of the plugin. default is 1.0.0. If the version is newer than what is saved in the database, the method `update()` will be called.

```
    public function update()
    {
    }

    public function install()
    {
    }
```

Do something if the plugin isn't registered in database yet, e.g. create tables.

```
    public function build()
    {
    }
```

Use this method and `$this->container` to add compiler passes, set container services or parameters.

```
    public function registerControllers()
    {
        return new ControllerCollection([
            'my_plugin.my_controller' => MyController::class,
            'majima.admin_controller' => AdminControllerDecorator::class,
        ]);
    }
```

Use this method to register new controllers or decorate existing ones. Since the id `majima.admin_controller`is already set, the service for that controller will be decorated. The new id for the decorated service will then be prepended by snake case of the plugin class name, so in this case it would be `my_plugin.majima.admin_controller`

```
    public function setRoutes()
    {
        $routeCollection = new RouteCollection();
        $routeCollection->addRoute(
            new RouteConfig(
                'myPlugin_index',
                '/hello/world/',
                'my_plugin.my_controller:indexAction'
            )
        );
        $routeCollection->addRoute(
            new RouteConfig(
                'admin_new',
                '/admin/new/',
                'my_plugin.majima.admin_controller:newAction'
            )
        );
        return $routeCollection;
    }
```

Enhance the routes to actions of controllers for the routing. The name/id of a route, e.g. `myPlugin_index`, will also determine, where the view for that action will be looked for. Underscores will be converted to slashes and the first letter will be capitalized. So in this example majima would look for a template `MyPlugin/index.tpl`

```
    public function setViewResources()
    {
        $viewCollection = new ViewCollection(join(DIRECTORY_SEPARATOR, [__DIR__, 'Resources']));
        $viewCollection->setViews(['views']);
        return $viewCollection;
    }

    public function setCssResources()
    {
        $assetCollection = new AssetCollection(join(DIRECTORY_SEPARATOR, [__DIR__, 'Resources', 'css', 'src']));
        $assetCollection->setFrontendAssets([
            join(DIRECTORY_SEPARATOR, ['frontend', 'all.scss']),
        ]);
        $assetCollection->setBackendAssets([
            join(DIRECTORY_SEPARATOR, ['backend', 'all.scss']),
        ]);
        return $assetCollection;
    }

    public function setJsResources()
    {
        $assetCollection = new AssetCollection(join(DIRECTORY_SEPARATOR, [__DIR__, 'Resources', 'js', 'src']));
        $assetCollection->setFrontendAssets([
            join(DIRECTORY_SEPARATOR, ['frontend', 'jquery.js']),
        ]);
        $assetCollection->setBackendAssets([
            join(DIRECTORY_SEPARATOR, ['backend', 'jquery.plugin.js']),
        ]);
        return $assetCollection;
    }
}
```

Collect views for routes and assets for compilation. Assets can be separated for use in frontend and backend context (when user is logged in).

##### Controller Example

[](#controller-example)

By extending `MajimaController` you will gain access to the following references

```
$this->container //returns instance of DependencyInjection\Container
$this->dbal //returns instance of FluentPDO
$this->engine //returns instance of Dwoo\Core

```

```
class MyController extends MajimaController
{
    /**
     * @param Request $request
     */
    public function indexAction(Request $request)
    {
        $bar = $this->dbal->from('foo')->fetchAll();

        $this->assign(
            [
                'foo' => $bar,
            ]
        );
    }
}
```

[FluentPDO](https://github.com/envms/fluentpdo) is a query builder
[Dwoo](https://github.com/dwoo-project/dwoo) is the template engine of majima
Use `assign` to pass an array of data to views.

If the route to the action can be resolved as a path to a template (see above), you don't have to return anything in your action. If you're outside of the conventions, you can render a template and return a response yourself:

```
    // returns Response with rendered content
    return $this->engine->render('/path/to/my/template.tpl');
```

##### Template functions

[](#template-functions)

Adding to Dwoo's own functions majima introduces a few more:

```
{inherits "Index/index.tpl"}

```

Virtually the same as Dwoo's `extends` but allows you to inherit templates from the majima's base HTML bootstrap and views of previously loaded plugins.

```
{url "index_index" array('foo' => $bar)}

```

Will generate the url of a registered route. Optionally pass an array of GET parameters.

```
{link "/web/css/style.min.css", $.cache_buster}

```

Get the absolute path to an asset. Optionally pass a cache buster value. You can use the global `$.cache_buster` which will be regenerated once the cache is emptied.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3166d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/69c1745bd6023c706f651e9bdb38515fc7678caf52b9580126141381168669cd?d=identicon)[dneustadt](/maintainers/dneustadt)

---

Top Contributors

[![dneustadt](https://avatars.githubusercontent.com/u/9033214?v=4)](https://github.com/dneustadt "dneustadt (20 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

---

Tags

assetsmicro-frameworkmysqlphptemplate-inheritancesymfonyframework

### Embed Badge

![Health badge](/badges/dneustadt-majima/health.svg)

```
[![Health](https://phpackages.com/badges/dneustadt-majima/health.svg)](https://phpackages.com/packages/dneustadt-majima)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M151](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
