corpuscom/blost-laravel
Blost Laravel is a Laravel-friendly integration for the Blost package, providing straightforward installation, configuration, and framework conventions so you can add Blost functionality to your PHP app quickly. It keeps setup clean and maintainable for developers.
Install and publish everything in one pass:
composer require "corpuscom/blost-laravel:^1.0"
php artisan vendor:publish --provider="Corpuscom\BlostLaravel\BlostServiceProvider"
php artisan migrate
The service provider is auto-discovered, so there is no config/app.php step. vendor:publish is the single most important command in the package — it gives you the config file (connector token, route/prefix and pagination settings), the migration, and the Blade templates you will almost certainly need to override. Publish the config first, then read it top to bottom before writing any code; it is the map of everything else.
Where to look first, in order:
config/blost.php (name may differ slightly — whatever lands in config/) for the connector token and route prefix.vendor/corpuscom/blost-laravel/src/ for the Article model, the published-scope logic, and the controllers behind the public pages.vendor/corpuscom/blost-laravel/resources/views/ before you copy templates into resources/views/vendor/..., so you override the smallest surface possible.First use case: the zero-UI path. Configure the token, run the migration, publish two articles through the bundle's publishing API (shared with corpuscom/blost-bundle), then hit the public listing route. That single loop — publish via API, read via Blade — validates token auth, the UUID primary key, UTC date handling, and the scheduled-visibility scope at once. Only after that loop is green should you start overriding views or mounting your own routes.
Treat the publishing API as the write path, Eloquent as the read path. The package deliberately splits these: writes go through corpuscom/blost-bundle's shared authenticated API, reads go through Eloquent and Blade. Day-to-day, that means your app should not be creating Article records directly in application code. If you need synthetic or seeded content, publish through the API rather than mass-inserting rows, otherwise you will drift from whatever fields and invariants the bundle enforces.
Wrap reads in a scope, not in controller conditionals. Scheduled visibility implies a query constraint (roughly where('published_at', '<=', now())). Do not re-implement it per controller. Confirm the exact scope name in the source and use it consistently, including in your own custom queries, sitemaps, feeds, and search endpoints — anything that queries articles without the scope will leak future-dated posts.
Cache with a short TTL around publication boundaries. Because visibility changes on a timestamp rather than on a write, a cached listing will not invalidate itself when a post goes live. Either cache with a TTL shorter than your typical scheduling granularity, or key the cache by the next scheduled publish time for the collection.
Override templates by publishing, not by editing vendor. Blade resolution prefers resources/views/vendor/... for published namespaces, so copy only the listing and detail templates you intend to change. Keep a diff of the published originals so you can spot changes when you upgrade within ^1.0.
Mount the public routes under your own prefix if /blog is already taken. Publishing the config should expose the route prefix; change it there rather than wrapping the package routes in a group, so internal route names and generated links stay consistent.
For a headless or Inertia front end, skip the Blade layer entirely and expose your own controller that uses the model plus the published scope, keeping pagination on the query builder so links() semantics survive if you later add a view. The package's public pages remain useful as a reference implementation and as a smoke test that the connector is configured correctly.
Media is referenced, not mirrored. Upload assets to your own storage/CDN and publish absolute URLs. Build a small helper or accessor for image URLs so a future CDN migration is a one-line change rather than a content rewrite through the API.
$incrementing = false, $keyType = 'string', and route model binding on a non-integer key. findOrFail, whereKey, and relation foreign keys must be string-typed; orderBy('id') is meaningless as a chronology, so order by published_at and add a tiebreaker for stable pagination.published_at can duplicate or skip rows across pages. Add a secondary sort key (the UUID is fine as a tiebreaker) in any custom listing query..env and out of version control, rotate it, and never expose a write proxy to a browser. If any author is untrusted, sanitize on ingest or before render — do not rely on the package.corpuscom/blost-bundle ^1.0 is a hard requirement; a bundle minor release can change the payload shape your app depends on. Pin the bundle explicitly in composer.json if you are not prepared to test its upgrades, and read its changelog rather than only this package's./blog route or a blog.index route name will conflict silently. Check php artisan route:list after install.php artisan config:clear before concluding anything about auth.^1.0: re-publish and diff the config and views after each bump; published copies do not track vendor changes automatically, so a new config key will simply be absent and fall back to a default you never saw.How can I help you explore Laravel packages today?