PHPackages                             startplatz/wordpress-integration-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. startplatz/wordpress-integration-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

startplatz/wordpress-integration-bundle
=======================================

Integration of WordPress in Symfony

2.2.2(4w ago)610.3k2[1 issues](https://github.com/startplatz/wordpress-integration-bundle/issues)MITPHPPHP &gt;=8.1

Since Nov 18Pushed 4w ago14 watchersCompare

[ Source](https://github.com/startplatz/wordpress-integration-bundle)[ Packagist](https://packagist.org/packages/startplatz/wordpress-integration-bundle)[ Docs](http://github.com/startplatz/wordpress-integration-bundle)[ RSS](/packages/startplatz-wordpress-integration-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (9)Versions (15)Used By (0)

WordPress Integration Bundle
============================

[](#wordpress-integration-bundle)

Open-Source Bundle to integrate WordPress in a Symfony2 Project.

Features:

- Using WordPress and Symfony in parallel
- Using layout from WordPress as a Twig - Template by annotation
- Use Symfony Controller output as WordPress Shortcodes

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require wordpress-integration-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require startplatz/wordpress-integration-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Startplatz\Bundle\WordpressIntegrationBundle\StartplatzWordpressIntegrationBundle::class => ['all' => true],
];
```

Manual Steps
------------

[](#manual-steps)

enable a route that should be handled by WordPress in your routing configuration (e.g. config/routing.yaml)

```
....
wordpress:
    resource: "@StartplatzWordpressIntegrationBundle/Controller/PassthruController.php"
    type: annotation

```

Note: all your other routes should be configured in advance.

For Apache 2 User: Take the sample .htaccess file to your document root and adjust it to your needs e.g. Error Handling etc. Note: It is better to prevent WordPress from changing this file!

For other HTTP-Server you need to setup the rules based on the Apache rules

Setup WordPress
---------------

[](#setup-wordpress)

Your WordPress Installation should be located in the `public` - folder of your Symfony2 - Project

To complete the integration you should update the globals - cache by calling the Symfony Console Command:

```
app/console startplatz:wordpress-integration:build-global-names-cache

```

Configuration
-------------

[](#configuration)

Add file `config/startplatz_wordpress_integration.yaml` (if it is not done by flex yet)

```
startplatz_wordpress_integration:
    wordpress_root_dir: '%kernel.project_dir%/../public'

```

- **wordpress\_root\_dir**: Directory, where Wordpress is installed - mandatory, no default value

Implementation
--------------

[](#implementation)

### Using WordPress output as Twig - Template

[](#using-wordpress-output-as-twig---template)

#### Usage in Controller and Twig Template

[](#usage-in-controller-and-twig-template)

defining the WordPress URL as template via annotation

```
