mediapart/lapresselibre-bundle
A Symfony bundle from Mediapart for integrating La Presse Libre content and services into your PHP application. It provides ready-made configuration and service wiring so you can pull La Presse Libre data with minimal setup. Lightly adopted, so expect limited docs and community support.
This is a thin Symfony integration for the mediapart/lapresselibre PHP client library — a wrapper around the La Presse Libre content/API service used by French independent media outlets. It exists to give you a configured API client as a container service rather than to provide any UI or domain logic of its own.
Minimal setup:
composer require mediapart/lapresselibre-bundle — but pin an exact version. A 2.0.1 release now exists, which means the package has moved past the 2017-era 1.x line the earlier guidance in this document assumed. We were not given release notes for 2.0.1, so treat the 2.x behaviour as unverified until you inspect the installed source.vendor/mediapart/lapresselibre-bundle/composer.json before anything else. Its require block tells you which Symfony versions and which version of the underlying mediapart/lapresselibre client the release targets — that single file resolves most of the ambiguity about whether this is still a Symfony 2.8/3.x bundle or has been modernised.new Mediapart\Bundle\LapresselibreBundle\LapresselibreBundle() to registerBundles() in app/AppKernel.php. On 2.x, check whether a Flex recipe exists (composer recipes) or whether the bundle now ships a bundles.php-compatible registration entry, before hand-editing a kernel.lapresselibre: under config.yml, or config/packages/lapresselibre.yaml on Flex). Read DependencyInjection/Configuration.php and DependencyInjection/LapresselibreExtension.php first — that is the single source of truth for available keys and the service IDs it registers.Where to look first: composer.json (version/Symfony support), then Resources/config/services.yml (service IDs, class names, whether services are public), then the underlying library's client class and README. The bundle itself is ~a few hundred lines of glue; almost all behaviour lives in the library.
First use case: a one-off console command that authenticates and pulls a single content item or listing, so you can verify credentials and response shape before wiring it into a controller. Do this immediately after upgrading to 2.0.1 — it is the fastest way to detect whether the config tree or service IDs changed.
Inject the client, don't reach for the container. On the legacy line the service is not autowired by default. Either declare it as an argument in your own services.yml:
app.article_sync:
class: AppBundle\Command\SyncArticlesCommand
arguments: ['@lapresselibre.client']
or, if you are on a newer Symfony (or 2.x has added autowiring), define an alias in services.yaml and autowire against the library's client interface. Confirm which applies by dumping the container after install — do not assume.
Wrap the client in a domain service. The bundle gives you a transport-level client. Create App\Service\PresselibreGateway that owns the client, normalises responses into your own DTOs, and exposes intent-revealing methods (findArticleBySlug, listLatest). This keeps the third-party API shape out of your controllers and makes the eventual replacement of the bundle a single-file change — which matters given the uncertain maintenance signal.
Console command for ingest. The natural day-to-day workflow is scheduled sync: a command that fetches a batch, maps to entities, and flushes. Use Doctrine batch inserts with a configurable page size, track a cursor/updated_at watermark in a local table, and make the command idempotent so re-runs after a failure are safe.
Cache aggressively. Since it's a remote HTTP API, put a PSR-6/Symfony cache pool in front of read calls via a decorator. Cache keys should include the request parameters and a TTL derived from config. This both speeds up page rendering and shields you from rate limits and upstream outages.
Controller usage. For simple read-through pages, render the normalised DTO into Twig. For anything user-facing with latency concerns, fetch in a warmup command or a background job (e.g. an event dispatched to a queue worker) rather than in the request cycle.
Error handling at the boundary. Catch the library's exceptions in your gateway and convert to your own exception types; let controllers return a 502/ServiceUnavailableHttpException when the upstream is down, and serve a cached or empty state when possible.
Integration testing. Because the bundle's service is just a client configured with base URL/credentials, you can point config at a local stub (a small Symfony app or a MockHttpClient if the 2.x line has modernised onto Symfony HttpClient) and swap the base URL in the test environment.
Upgrade pattern for 2.0.1. Treat it as a reviewable diff: check out both versions and diff Configuration.php, LapresselibreExtension.php, and Resources/config/services.yml. Those three files carry essentially every breaking change a glue bundle of this size can make.
The "archived, last release 2017" characterisation is now out of date. A 2.0.1 release exists, so the package is not frozen at 2017. However, we had no release notes for this version, so we cannot state what changed, whether the underlying mediapart/lapresselibre dependency was bumped, or whether the maintenance is a one-off republish. Do not interpret the version bump as a guarantee of active maintenance — verify the commit history and tag date in the repo before relying on it.
A major version bump is the headline risk. Jumping to a 2.x line implies breaking changes relative to whatever 1.x you had installed. Pin exact versions ("mediapart/lapresselibre-bundle": "2.0.1"), and if you are upgrading an existing app, do it as a discrete PR with the smoke-test command from Getting Started as the acceptance check.
Symfony version mismatch remains the biggest trap. A historically Symfony 2.8/3.x-era bundle assumes AppKernel, XML/YAML service definitions without autowiring, no bundles.php, no attribute config. If 2.x modernised this, great — but confirm from composer.json and the presence or absence of Resources/config/services.yaml vs .yml, and whether services are still marked public. Under Symfony 5/6, strict return types and deprecated APIs may break a legacy definition outright.
Config key names are undocumented. Read Configuration.php — and re-read it after the 2.0.1 upgrade, because config trees are the most common thing to change in a major. Symfony silently rejects unknown keys (often as a confusing "Unrecognized option" deep in a stack trace), and missing required keys surface only at first service instantiation, not at container compile time — so smoke-test the service in a command early.
Service ID guessing. The bundle is not necessarily consistent about naming, and a major version is exactly when IDs get renamed. Dump the container (debug:container --tag=... or debug:container | grep -i lapresse) rather than assuming lapresselibre.client still resolves after the upgrade.
No autoconfigure/autowire tags on the legacy line. Don't rely on Symfony's modern defaults for this bundle's services; if they are defined explicitly in its own services.yml they won't carry autoconfigure: true. Re-check this on 2.x rather than carrying the assumption forward.
Timeout and retry are your responsibility. The client likely does not expose retry/backoff. Configure the HTTP transport (Guzzle handler stack or Symfony HttpClient) with explicit connect/read timeouts and a retry middleware, otherwise a stalled upstream can hang a worker or a request.
Debugging: enable Symfony's debug HTTP collector if the library uses the framework's HTTP client or Guzzle with the Symfony middleware; otherwise log request/response in your gateway wrapper. Log the raw response on parse failures — the API's error bodies are more useful than the library's exception messages.
Extension points: the practical ones are (a) service decoration — decorate the client to add caching, logging, or response normalisation; (b) a compiler pass if you need to swap the client implementation for a fake in tests; (c) your own gateway service, which is usually cleaner than either. The bundle does not expose events or a plugin system.
License caveat: the metadata previously reported NOASSERTION. Re-check the LICENSE file and the license field in the 2.0.1 composer.json — a new release is a plausible moment for the license to have been clarified or changed. Mediapart is a commercial news organisation, and terms may be restrictive (or absent, which defaults to "all rights reserved"). Confirm you have the right to use and modify it, especially if you plan to fork.
How can I help you explore Laravel packages today?