pmvc/pmvc

Pure plugin framework (PMVC with PHP8), use anything you like. No mvc, http inside.


README

PMVC

A simple MVC for unidirectional dataflow architecture.

Latest Stable Version Latest Unstable Version CircleCI StyleCI Coverage Status License Total Downloads

Getting Started

How to use?

plug( 'PluginName', ['option'] );

Plugin Hello world

  • Source Code
<?php
namespace PMVC\PlugIn\hello_world;
${_INIT_CONFIG}[_CLASS] = __NAMESPACE__.'\hello_world';
class hello_world extends \PMVC\PlugIn
{
    public function say()
    {
        echo $this[0]."\n";
    }
}
  • Used
\PMVC\plug('hello_world', ['Hello, PMVC.'])->say();

PlugIn features

  • addPlugInFolders
  • callPlugin
  • unPlug
  • rePlug
  • initPlugIn
  • plug

PlugIn Generator

MVC

PMVC Family

Explain addPlugInFolders

The last folder will have more high priority.

Such as

addPlugInFolders(['./a', './b'])

If folder a and folder b both have same plugin will apply with folder b.

Quick test

composer require pmvc/pmvc

Quick test with docker

docker run --rm -v $(pwd):/var/www/html allfunc/pmvc-phpunit composer require pmvc/pmvc
  • vim test.php
<?php
 include_once('vendor/autoload.php');
 \PMVC\Load::plug();
 \PMVC\d("Hello There");
  • Run
docker run --rm -v $(pwd):/var/www/html allfunc/pmvc-phpunit php ./test.php

MIT 2023