Download the PHP package happyr/wordpress-bundle without Composer

On this page you can find all versions of the php package happyr/wordpress-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wordpress-bundle

Happyr WordPress Bundle

Let your editors write blog posts with Wordpress excellent backend but still deliver super quick responses, leverage Twig and integrate with your blog content with your Symfony application. As an extra bonus, this means that your WordPress application does not need to be exposed to the internet.

This is a small bundle that talks to the WordPress REST API. We make sure to cache each request so your blog do not get overwhelmed with requests.

WordPress configuration

Rewriting links

We need to rewrite absolute URLs from WordPress. To make things easier for us, please set your page and post url prefix to "page".

Invalidate cache

You should configure Symfony to be very aggressive when caching resources from WordPress. But when an editor makes an update you need to invalidate the cache and redownload the updated resource.

The Symfony bundle provides an endpoint to invalidate cache. You should use this endpoint when a post in updated and deleted.

(TODO add a small wordpress plugin for this in Resources/Wordpress)

Symfony installation

There are quite a few moving parts to set up this bundle. But they all make perfect sense. Lets take them one by one:

API endpoint

Where is your WordPress blog? You should define the endpoint to the build-in REST API. In the example below we assume you access your WordPress app with the following URL: http://demo.wp-api.org.

Templates

The bundle comes with 2 default templates. One for an index page that list your latest posts and one template for a single post/page. You should of course replace these with something you like better. This could easily be done with some configuration:

Routes

To enable the default controllers you need to include the provided routes.yaml.

You may of course use your own controllers. Just make sure that you define a route named happyr_wordpress_page.

Caching

WordPress is a great tool but it is slower than your Symfony application. Make sure we cache all responses from Wordpress. We use Symfony\Contracts\Cache\CacheInterface for caching because it got stampede protection built-in.

Parsers

When we fetch data from WordPress we need to parse it somehow. We need to make sure all links refer to the symfony application and not the WordPress application. We also need to handle the image references.

You may disable parses you do not want with configuration:

You may also add your own parsers by register a new service and tag it with happyr_wordpress.parser.page or happyr_wordpress.parser.menu.

Images

We do not want any references to images to go to the WordPress application. We need to download the image and upload it somewhere good. Like AWS S3. You can configure the RewriteImageReferences parser with a custom uploader to achieve this. Make sure your uploader implements ImageUploaderInterface.

The default uploader uploads images to a local folder. This is alright if there only is a few images and you have CloudFront or any other reverse proxy caches in front of your Symfony application.


All versions of wordpress-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
symfony/config Version ^4.4 || ^5.3 || ^6.0
symfony/dependency-injection Version ^4.4 || ^5.3 || ^6.0
symfony/framework-bundle Version ^4.4 || ^5.3 || ^6.0
symfony/http-kernel Version ^4.4 || ^5.3 || ^6.0
twig/twig Version ^2.14 || ^3.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package happyr/wordpress-bundle contains the following files

Loading the files please wait ....