rz/news-bundle
rz/news-bundle is a lightweight PHP package for adding news and article management to your application. It offers a simple structure for storing, listing, and displaying news posts, with Composer installation and framework-friendly configuration.
Confirm what this is before you spend a minute on it. rz/news-bundle is a Symfony bundle — not a Laravel package. There is no NewsServiceProvider, no facade, no extra.laravel block, no illuminate/* constraint, and no php artisan vendor:publish path. It is also archived, with zero stars and zero dependents. So "getting started" for a Laravel developer means reading it as reference material, not composer require-ing it.
Minimal steps:
composer.json. Verify the actual composer name — the repo is rzproject/NewsBundle but the package may be published as rz/news-bundle. Also read the require block: if you see symfony/framework-bundle, doctrine/orm, or sonata-project/*, that tells you exactly how much is Doctrine/Symfony-coupled versus plain PHP.Entity/, then Repository/, then Resources/config/ and DependencyInjection/. In RZ/News-style bundles the entity is the product — the schema and field names are the reusable artifact. Everything under Resources/ is Symfony wiring you will throw away.First use case for a Laravel dev: translate the News (or Post/Article) Doctrine entity into an Eloquent model, generate a Laravel migration from its column definitions, and add a published() scope based on whatever date/flag columns the entity exposes. That's a two-hour exercise that gives you a defensible schema and a working model, with zero dependency on archived code.
If you are genuinely on Symfony, the steps are: require it, register Rz\NewsBundle\RzNewsBundle::class => ['all' => true] in config/bundles.php, confirm Doctrine ORM is installed (the bundle does nothing without it), then generate a migration from the mapping and expose a trivial listing controller.
Port, don't depend. The only production-safe pattern is copy-and-own. Pull Entity/ and Repository/ into your own namespace, strip the Doctrine annotations, and rewrite as Eloquent. You inherit the schema design and lose the dead dependency.
Entity field → Eloquent cast mapping. This is the mechanical part of the port:
| Doctrine | Eloquent |
|---|---|
@ORM\Column(type="string") |
$casts not needed, plain string |
@ORM\Column(type="datetime") |
'published_at' => 'datetime' |
@ORM\Column(type="json_array") |
'meta' => 'array' |
@ORM\Column(type="boolean") |
'is_published' => 'boolean' |
@ORM\ManyToOne(targetEntity=Category::class) |
belongsTo(Category::class) |
@ORM\OneToMany(...) |
hasMany(...) |
@ORM\ManyToMany w/ join table |
belongsToMany(...) + a pivot migration |
Repository finders → query scopes. Bundles of this vintage typically ship finders like findPublished(), findLatest(), findBySlug(). Recreate them as local scopes so controllers stay thin:
public function scopePublished($q): void
{
$q->where('is_published', true)
->where('published_at', '<=', now());
}
public function scopeLatest($q): void
{
$q->orderByDesc('published_at');
}
Lifecycle callbacks → observers. If the Doctrine entity has @ORM\HasLifecycleCallbacks (common for createdAt/updatedAt or slug generation), that maps to Eloquent booted() hooks or an observer, not to model events copied verbatim.
Admin surface: skip Sonata entirely. If the bundle ships Sonata admin classes, they assume SonataAdminBundle plus its block/asset stack — a heavyweight dependency you do not want to recreate. On Laravel, reimplement the CRUD as a Filament resource or Nova resource against your ported model. The admin class is useful only as a checklist of which fields are editable and which are read-only.
Routing and templates → Laravel-native. The bundle's Resources/config/routing.* and Twig templates become routes/web.php entries and Blade views. Don't try to interpret the Symfony route definitions; just note the URL shape (/news, /news/{slug}) and slug-based lookup, which is the one design decision worth carrying over.
Adapter pattern if you're stuck in a mixed stack. If you genuinely have a Symfony service consuming the bundle's repository alongside Laravel code, wrap it behind a small interface (NewsReader::latestPublished(int $limit): Collection) implemented by an adapter. When you finish the Eloquent rewrite, it's a one-class swap instead of a hunt for call sites.
Use it as a requirements checklist. The fields, relations, and finders the bundle bothered to implement are a decent proxy for "what a news module needs at minimum": title, slug, body, author, category, publish flag, publish date, timestamps. That list scopes your internal build faster than a blank-page design session.
rzproject/NewsBundle vs. package rz/news-bundle — RZ bundles have shifted naming over the years. Confirm from composer.json before attempting an install, or you'll chase a package that 404s.$casts and $fillable, and delete the annotations.ResolveTargetEntityListener inheritance won't survive the port. RZ bundles often expect you to subclass the base entity and point Doctrine at your class. Eloquent has no equivalent; use single-table inheritance with a type column or separate models.config/bundles.php and nothing errors until you reference a service. Debug with bin/console debug:container | grep -i news.Configuration.php trees often have required nodes with no defaults. Missing YAML keys throw at container compile time, not at runtime, which makes them look like unrelated failures. Read the configuration tree before guessing.templates/bundles/RzNewsBundle/ and entity overrides go through the resolve-target mechanism — never edit vendor/. For Laravel users this is moot; you own the ported code outright.NOTICE file. It's archived third-party code living in your repo now.How can I help you explore Laravel packages today?