2017 © Pedro Peláez
 

symfony-bundle wordpress-integration-bundle

A WordPress integration bundle for Symfony2.

image

jaza/wordpress-integration-bundle

A WordPress integration bundle for Symfony2.

  • Tuesday, July 1, 2014
  • by Jaza
  • Repository
  • 2 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Symfony2 WordPress Integration Bundle

This bundle lets you render a Symfony2 web app via WordPress., (*1)

Installation

1 Add to the 'require' section of composer.json:, (*2)

    "require" : {
        "jaza/wordpress-integration-bundle": "1.0.*@dev",
    }

2 Register the bundle in app/AppKernel.php, (*3)

``` php $bundles = array( // ... new Jaza\WordPressIntegrationBundle\JazaWordPressIntegrationBundle(), );, (*4)


## Configuration 1 Add required config values to 'parameters.yml' file (or equivalent):

parameters: # ... wordpress_root: /path/to/wordpress wordpress_base_url: 'http://wordpress.baseurl', (*5)


2 Add various optional config values to 'parameters.yml' file (or equivalent):

parameters: # ... wordpress_is_embedded: true, (*6)


## Usage Create a controller in your bundle ``` php namespace YOURNAME\YOURBUNDLE\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function indexAction() { $title = 'Foo hoo'; // Get the WordPress integration service and bootstrap WordPress $wordPressIntegration = $this->container->get('wordpress_integration'); $wordPressIntegration->bootstrapWordPress(); // Easily check if the current response will be rendered via // WordPress or not - e.g. might have conditional template logic // based on this. $embedded = $this->container->getParameter('wordpress_is_embedded'); $engine = $this->container->get('templating'); // Render the Symfony template output and store it in a variable // here, rather than returning the response directly to // Symfony as you'd normally do. $content = $engine->render('FooBundle:Default:index.html.twig', array( 'title' => $title, 'embedded' => $embedded, )); // Return a Symfony Response object - whether the content in // the response is output via WordPress or not depends on the // 'wordpress_is_embedded' config value. return $wordPressIntegration->getResponse($content); } }

The Versions

01/07 2014

dev-master

9999999-dev

A WordPress integration bundle for Symfony2.

  Sources   Download

MIT

The Requires

 

by Jeremy Epstein

wordpress symfony2 bundle integration