PHPackages                             carlescliment/light-news-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. [Admin Panels](/categories/admin)
4. /
5. carlescliment/light-news-bundle

ActiveSymfony-bundle[Admin Panels](/categories/admin)

carlescliment/light-news-bundle
===============================

A simple, lightweight bundle to handle news or blog posts

39.2k5[1 PRs](https://github.com/carlescliment/light-news-bundle/pulls)PHP

Since Jul 2Pushed 13y ago2 watchersCompare

[ Source](https://github.com/carlescliment/light-news-bundle)[ Packagist](https://packagist.org/packages/carlescliment/light-news-bundle)[ RSS](/packages/carlescliment-light-news-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

LightNewsBundle
===============

[](#lightnewsbundle)

This bundle provides a lightweight framework to handle news or blog posts without the need of installing other heavy bundles like Sonata. The intention of LightNewsBundle is to allow developers adding their own logic without having to deal with the management of CRUD operations.

LightNewsBundle works with Symfony 2.1 and has almost no dependencies.

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

[](#installation)

### 1. Update your vendors

[](#1-update-your-vendors)

Add this line to your `composer.json`

```
"require": {
    "carlescliment/light-news-bundle": "dev-master"
}

```

Execute `php composer.phar update carlescliment/light-news-bundle`

### 2. Load the bundle in `app/AppKernel.php`

[](#2-load-the-bundle-in-appappkernelphp)

```
$bundles = array(
     // Your other bundles
     new BladeTester\LightNewsBundle\BladeTesterLightNewsBundle(),
);

```

### 3. Modify your `app/config/routing.yml`

[](#3-modify-your-appconfigroutingyml)

```
blade_tester_light_news_bundle:
    resource: "@BladeTesterLightNewsBundle/Resources/config/routing.yml"
    prefix:   /news        #choose the prefix you want

```

Configuring your own news bundle
--------------------------------

[](#configuring-your-own-news-bundle)

### 1. Create your own bundle overriding LightNewsBundle

[](#1-create-your-own-bundle-overriding-lightnewsbundle)

```
namespace My\NewsBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class MyNewsBundle extends Bundle
{

   public function getParent()
    {
        return 'BladeTesterLightNewsBundle';
    }
}

```

### 2. Map a News class

[](#2-map-a-news-class)

Create an entity and inherit the base News class. The only mandatory field you have to add is "id" to map your entity properly.

NOTE: At the moment it works only with Doctrine. Contribution to provide other drivers will be very appreciated.

```
namespace My\NewsBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use BladeTester\LightNewsBundle\Entity\News as BaseNews;

/**
 * @ORM\Entity()
 * @ORM\Table(name="news")
 */
class News extends BaseNews {

    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    public function getId() {
        return $this->id;
    }
}

```

### 3. Setup your News class in `app/config/config.yml` file:

[](#3-setup-your-news-class-in-appconfigconfigyml-file)

```
blade_tester_light_news:
    driver: doctrine/orm
    engine: twig
    classes:
        news:
            entity: 'My\NewsBundle\Entity\News'

```

### 4. Update your database schema

[](#4-update-your-database-schema)

```
app/console doctrine:schema:update --force

```

Basic usage
-----------

[](#basic-usage)

LightNewsBundle provides the basic CRUD management. It's up to you to handle the security to allow or disallow users to administer news.

By default, you can access to the following routes:

- {prefix}/ -&gt; Homepage
- {prefix}/{id} -&gt; Display a piece of news
- {prefix}/admin -&gt; Admin homepage
- {prefix}/admin/add -&gt; Create a piece of news.
- {prefix}/admin/{id}/remove -&gt; Delete the piece of news with id {id}.
- {prefix}/admin/{id}/edit -&gt; Edits the piece of news with id {id}.

Overriding the bundle
---------------------

[](#overriding-the-bundle)

LightNewsBundle is aimed to be easily overrideable. You can override it the same way you normally override bundles in Symfony.

### Templates

[](#templates)

Place a template with the same name and in the same dir and Symfony will load it instead of the default one. For example, you could override the template Default/base.html.twig and inherit your base app template.

### Controllers

[](#controllers)

Place a controller with the same name in your bundle to override the default behaviour

### Routes

[](#routes)

You can also override routes or define new ones.

### Forms

[](#forms)

LightNewsBundle provides a default form to manage the basic entity. If you create your entity with extra fields, you will need to use a custom form. Just configure it in your `app/config/config.yml` file

```
blade_tester_light_news:
    driver: doctrine/orm
    engine: twig
    classes:
        news:
            entity: Your\NewsBundle\Entity\News
    forms:
        news:
            class: Your\NewsBundle\Form\YourCustomForm

```

The manager
-----------

[](#the-manager)

If you plan to customize LightNewsBundle, you will probably need to use the NewsManager service. It will be better explained with an example:

```
public function yourCustomAction()
{
    $manager = $this->get('blade_tester_light_news.news_manager')
    $news = $manager->build(); // builds a non-persisted instance of your News class.
    $news = $manager->create('Title', 'body'); // builds and persists a piece of news.
    $news = $manager->find(33); // Retrieves the instance with id 33 from the database
    $manager->remove($news); // Removes a news instance
    $all_news = $manager->findAll(); // Retrieves all the instances from the database
$manager->refresh($news); // Uses the entity manager to refresh the item
}

```

Credits
-------

[](#credits)

- Author: [Carles Climent](https://github.com/carlescliment)
- Contributor: [Fran Moreno](https://github.com/franmomu)

Contribute and feedback
-----------------------

[](#contribute-and-feedback)

Please, feel free to provide feedback of this bundle. Contributions will be much appreciated.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2a85fbd3df7cb8270d08d62ca42ba012b02cad5ff2a146dcc544ca658f92689?d=identicon)[carlescliment](/maintainers/carlescliment)

---

Top Contributors

[![carlescliment](https://avatars.githubusercontent.com/u/1255401?v=4)](https://github.com/carlescliment "carlescliment (34 commits)")[![franmomu](https://avatars.githubusercontent.com/u/720690?v=4)](https://github.com/franmomu "franmomu (2 commits)")

### Embed Badge

![Health badge](/badges/carlescliment-light-news-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/carlescliment-light-news-bundle/health.svg)](https://phpackages.com/packages/carlescliment-light-news-bundle)
```

PHPackages © 2026

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