PHPackages                             marphy/pressflow-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. marphy/pressflow-bundle

ActiveSymfony-bundle

marphy/pressflow-bundle
=======================

Symfony bundle for integrating Pressflow blog management

v0.1.0(yesterday)00MITPHPPHP &gt;=8.2

Since Mar 22Pushed yesterdayCompare

[ Source](https://github.com/marphy-sk/pressflow-symfony)[ Packagist](https://packagist.org/packages/marphy/pressflow-bundle)[ RSS](/packages/marphy-pressflow-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (9)Versions (2)Used By (0)

Pressflow Bundle for Symfony
============================

[](#pressflow-bundle-for-symfony)

Integrate [Pressflow](https://pressflow.io) blog management into your Symfony application. Fetch and display articles, categories, and tags from the Pressflow API. Add analytics tracking with a single Twig call.

**Pressflow** is a headless blog management platform — you manage content in the Pressflow dashboard, and display it on your own website through the API. This bundle makes that integration seamless in Symfony.

Features
--------

[](#features)

- **Typed API client** — `PressflowClientInterface` with full DTO models
- **Built-in caching** — responses cached via Symfony Cache, configurable TTL
- **Twig functions** — `pressflow_articles()`, `pressflow_article()`, `pressflow_tracker()` and more
- **Analytics tracking** — one-line `` tag integration, GDPR-friendly
- **Connection test** — `bin/console pressflow:test` to verify API setup
- **Symfony 7.2+** — PHP 8.2+, readonly DTOs, constructor promotion

Requirements
------------

[](#requirements)

- PHP 8.2+
- Symfony 7.2+
- A [Pressflow](https://pressflow.io) account with an API key

Installation
------------

[](#installation)

```
composer require marphy/pressflow-bundle
```

If you're not using Symfony Flex, register the bundle manually:

```
// config/bundles.php
return [
    // ...
    Marphy\PressflowBundle\PressflowBundle::class => ['all' => true],
];
```

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

[](#configuration)

Create `config/packages/pressflow.yaml`:

```
pressflow:
    api_key: '%env(PRESSFLOW_API_KEY)%'
    public_key: '%env(PRESSFLOW_PUBLIC_KEY)%'
```

Add your keys to `.env`:

```
PRESSFLOW_API_KEY=your-server-side-api-key
PRESSFLOW_PUBLIC_KEY=your-client-side-tracking-key
```

You'll find both keys in your Pressflow dashboard under **Settings → API Key**.

### Full configuration reference

[](#full-configuration-reference)

```
pressflow:
    api_key: '%env(PRESSFLOW_API_KEY)%'       # Required. Server-side key for fetching content.
    public_key: '%env(PRESSFLOW_PUBLIC_KEY)%'  # Required. Client-side key for analytics tracking.
    base_url: 'https://api.pressflow.io'      # Default. Your Pressflow API URL.
    cache_ttl: 300                             # Default. Cache lifetime in seconds. Set 0 to disable.
```

Quick Start
-----------

[](#quick-start)

### 1. Verify connection

[](#1-verify-connection)

```
php bin/console pressflow:test
```

```
Pressflow Connection Test
========================

 API URL:    https://api.pressflow.io
 API Key:    a1b2c3d4...

 ✓ Articles: 12 found
 ✓ Categories: 3 found
 ✓ Tags: 7 found

 All checks passed!

```

### 2. Create a controller

[](#2-create-a-controller)

```
use Marphy\PressflowBundle\Client\PressflowClientInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class BlogController extends AbstractController
{
    #[Route('/blog', name: 'blog_index')]
    public function index(PressflowClientInterface $pressflow): Response
    {
        return $this->render('blog/index.html.twig', [
            'articles' => $pressflow->getArticles(limit: 10),
            'categories' => $pressflow->getCategories(),
        ]);
    }

    #[Route('/blog/{slug}', name: 'blog_show')]
    public function show(string $slug, PressflowClientInterface $pressflow): Response
    {
        return $this->render('blog/show.html.twig', [
            'article' => $pressflow->getArticle($slug),
        ]);
    }
}
```

### 3. Render in Twig

[](#3-render-in-twig)

```
{# templates/blog/index.html.twig #}
Blog

{% for article in articles.articles %}

        {{ article.title }}
        {% if article.excerpt %}
            {{ article.excerpt }}
        {% endif %}
        {% if article.publishedAt %}
            {{ article.publishedAt }}
        {% endif %}

{% endfor %}

{# Pagination #}
{% if articles.nextCursor %}
    Next page
{% endif %}
```

```
{# templates/blog/show.html.twig #}

    {{ article.title }}
    {{ article.content|raw }}

    {% if article.tags %}

            {% for tag in article.tags %}
                #{{ tag }}
            {% endfor %}

    {% endif %}

{# Analytics tracking — add before  #}
{{ pressflow_tracker(article.id) }}
```

API Reference
-------------

[](#api-reference)

### PressflowClientInterface

[](#pressflowclientinterface)

Type-hint this interface in your controllers and services. The bundle autowires it with the cached client.

```
interface PressflowClientInterface
{
    public function getArticles(int $limit = 20, ?string $cursor = null, ?string $categoryId = null): ArticleList;
    public function getArticle(string $slug): Article;
    /** @return Category[] */
    public function getCategories(): array;
    /** @return Tag[] */
    public function getTags(): array;
}
```

### Twig Functions

[](#twig-functions)

FunctionReturnsDescription`pressflow_articles(limit, cursor, categoryId)``ArticleList`Paginated list of published articles`pressflow_article(slug)``Article`Single article by URL slug`pressflow_categories()``Category[]`All categories`pressflow_tags()``Tag[]`All tags`pressflow_tracker(articleId)``string`Renders analytics `` tag### Models

[](#models)

**Article** — `id`, `title`, `slug`, `content` (HTML), `excerpt`, `featuredImageUrl`, `categoryId`, `metaTitle`, `metaDescription`, `ogImageUrl`, `canonicalUrl`, `publishedAt`, `tags` (string\[\])

**ArticleList** — `articles` (Article\[\]), `nextCursor` (?string)

**Category** — `id`, `name`, `slug`, `parentId`, `description`

**Tag** — `id`, `name`, `slug`

All models are readonly DTOs with `fromArray()` factory methods.

Analytics Tracking
------------------

[](#analytics-tracking)

Pressflow tracks page views on your blog using a lightweight JavaScript snippet. The bundle handles the integration:

```
{# Renders a  tag with your public key #}
{{ pressflow_tracker(article.id) }}
```

Output:

```

```

- No cookies, no personal data — GDPR-friendly
- Visitor identity anonymized via server-side hashing
- View your analytics in the [Pressflow dashboard](https://app.pressflow.io)

Caching
-------

[](#caching)

All API responses are cached using Symfony's `cache.app` pool. Default TTL is **5 minutes** (300 seconds).

```
pressflow:
    cache_ttl: 600  # 10 minutes
```

Set `cache_ttl: 0` to disable caching (useful during development).

The cache uses keys like `pressflow.articles.{hash}`, so clearing is straightforward:

```
php bin/console cache:pool:clear cache.app
```

Error Handling
--------------

[](#error-handling)

All API errors throw `PressflowException`:

```
use Marphy\PressflowBundle\Exception\PressflowException;

try {
    $article = $pressflow->getArticle('non-existent');
} catch (PressflowException $e) {
    $e->getMessage();   // "Article not found"
    $e->statusCode;     // 404
    $e->errorCode;      // "NOT_FOUND"
}
```

About Pressflow
---------------

[](#about-pressflow)

[Pressflow](https://pressflow.io) is a headless blog management platform. Write and manage articles in the Pressflow dashboard, deliver them anywhere through the API.

- AI-powered article generation
- Built-in SEO management
- Analytics tracking
- Multi-tenant (manage multiple blogs)
- MCP integration for LLM tools

[Sign up for free](https://pressflow.io) — no credit card required.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE) file.

Contributing
------------

[](#contributing)

Issues and pull requests welcome at [github.com/marphy-sk/pressflow-symfony](https://github.com/marphy-sk/pressflow-symfony).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ee539ab4b7e2e96227a019c86cae09c94e9f9680810649d0ee35bbd2301512b?d=identicon)[marphy](/maintainers/marphy)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marphy-pressflow-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/marphy-pressflow-bundle/health.svg)](https://phpackages.com/packages/marphy-pressflow-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M128](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k14.6k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.0M341](/packages/shopware-core)[contao/manager-bundle

Provides the Contao Managed Edition

181.2M54](/packages/contao-manager-bundle)[wikimedia/toolforge-bundle

Symfony bundle providing useful Toolforge features.

1519.0k1](/packages/wikimedia-toolforge-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
