fup/wordpress-middleware

This PSR-15 middleware allows you to include Wordpress into your Middleware-Pipeline

2.0.1-alpha 2018-01-24 13:56 UTC

README

This PSR-15 middleware allows you to include Wordpress into your Middleware-Pipeline

Getting Started

Prerequisites

  • Install Wordpress within a public accesible directory of your webserver.
  • install composer if you haven't yet (seriously install composer)
  • TemplateRendererInterface Implementation to pass into WordpressAction

Installing

Install Composer

$ composer require fundp/wordpress-psr15-bridge

Generate WordpressAction with a factory. Inject TemplateRendererInterface-Implementation, the WordpressBridgeService within this lib and

    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $template = $container->get(TemplateRendererInterface::class);
        $wordpressBridgeService = $container->get(WordpressBridgeService::class);
        return new WordpressAction($template, $wordpressBridgeService, 'yourproject::your-template');
    }

pipe Action into your pipeline

$app->pipe( WordpressAction::class);

register action and your factory in your dependency injection. May look like this with Zendframework

return [
   'factories'  => [
      WordpressAction::class => WordpressActionFactory::class
   ]
];

Create a TemplateFile that contains the necessary Template-Variable like this

blank-wordpress.phtml

<?= $this->wordpress_string?>

Running the tests

$ Run, Forrest, run!

Built With

Contributing

Workflow for contributing is not defined yet which leaves all the opportunities to you by now.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Inspired by legacy integration approach of RalfEggert