PHPackages                             netcore/module-content - 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. netcore/module-content

ActiveModule

netcore/module-content
======================

v2.1.20(7y ago)02.6k[16 issues](https://github.com/netcore/module-content/issues)PHPPHP &gt;=7.0

Since Oct 26Pushed 7y ago6 watchersCompare

[ Source](https://github.com/netcore/module-content)[ Packagist](https://packagist.org/packages/netcore/module-content)[ RSS](/packages/netcore-module-content/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (90)Used By (0)

Content management with widgets v2.1
------------------------------------

[](#content-management-with-widgets-v21)

Idea behind this package is that many webpages are constructed from different sections, that look different in frontend, but they can use identical UI and database structure in backend. For example, a typical landing page might consist from following sections:

1. Large slider with images. Each image has large title and smaller subtitle.
2. A grid of services provided by webpage. Each item in grid has image, title and subtitle.
3. Testimonials. Each item has image, person's name, and content.
4. Brands. Each item has image and link to external website.
5. Employees. Each item has image, name, position, age and link to Linkedin.

We call these sections "widgets". Each of these look very different in frontend, but backend can be made universal. That's because we typically need the same fields over and over again - image, title, subtitle, content. Any not so common fields, like links, buttons or other non-standard information is stored in a JSON format.

In order to add a new widget to your page, you would perform only the following actions:

1. Seed new widget in database
2. Create custom frontend template file for that widget

And that's it! Backend will be generated automatically. You can reorder, edit, and add new widgets to pages. Screenshot:

[![screenshot](https://camo.githubusercontent.com/f377295239ebee838d2b5e7312094b368ade023250dfca2920ff6f93958be418/68747470733a2f2f696d6167652e70726e747363722e636f6d2f696d6167652f4b344944547156465368755f456341557674417536772e706e67)](https://camo.githubusercontent.com/f377295239ebee838d2b5e7312094b368ade023250dfca2920ff6f93958be418/68747470733a2f2f696d6167652e70726e747363722e636f6d2f696d6167652f4b344944547156465368755f456341557674417536772e706e67)

Pre-installation
----------------

[](#pre-installation)

This package is part of Netcore CMS ecosystem and is only functional in a project that has following packages installed:

1.
2.
3.

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

[](#installation)

Require this package with composer:

```
composer require netcore/module-content:2.1.*

```

Publish config, assets, migrations. Migrate and seed:

```
php artisan module:publish-config Content
php artisan module:publish Content
php artisan module:publish-migration Content
php artisan migrate
php artisan module:seed Content

```

Package also comes with basic ResolverController.php and routes for showing static pages and channels. It will work for many simple pages. If you need something more sophisticated or custom, you will need to implement your own Resolver. However, in most cases add this to your RouteServiceProvider.php (typically in `mapeWebRoutes()` method:

```
Route::group([
    'middleware' => ['web'],
    'namespace'  => null,
], function (Router $router) {
    \Modules\Content\Http\ResolverRouter::register($router);
});

```

After installation, you should config `config/netcore/module-content.php` file.

Updating to new version
-----------------------

[](#updating-to-new-version)

Let's imagine you have installed version v2.1.0, but a couple of days later v2.1.1 is released. Because we are working with , simply doing `composer require netcore/module-content` might not be enough, because there might be changes in assets and/or migrations. Therefore, to install new version, you should run all the following commands:

```
composer update netcore/module-content
php artisan module:publish Content
php artisan module:publish-migration Content
php artisan migrate

```

Terminology
-----------

[](#terminology)

Before working with this package, it can be helpful to understand basic terminology:

1. Entry - this is a page. It can be either a standalone page like "Terms and services", or it can belong to a channel. For example - page "Post 1" in "Blog" channel.
2. Channel - this is a group of entries. Common examples of channels are "Blog", "News", "Reports".
3. Section - sections are currently not used anywhere and will be deleted in version 0.1.x
4. Widget - some sort of section that exists in page. Common examples are LargeSliderWidget, TestimonialsWidget, EmployeesWidget.

It is better to keep everything in separated seed files, because it can get messy after some time. We recommend to create WidgetSeeder, ChannelSeeder, PageSeeder

Adding a new widget
-------------------

[](#adding-a-new-widget)

1. Start with widget seeding

```
content()->storeWidgets([
            'Employees widget' => [
                'is_enabled'    => 1,
                'widget_fields' => [
                    'Block title'       => [ // These are our employees
                        'type' => 'text',
                    ],
                    'Block description' => [ // We have many different employees, you can see every one of them here.
                        'type' => 'textarea',
                    ],
                ],
                'item_fields'   => [
                    'Name'        => [ // John Doe
                        'type' => 'text',
                    ],
                    'Job title'   => [ // Backend developer
                        'type' => 'text',
                    ],
                    'Description' => [ // My job is to do some stuff.
                        'type' => 'textarea',
                    ],
                    'Picture'     => [ // Picture of John Doe
                        'type' => 'file',
                        'options' => [ // options are optional
                            'width'  => 555, // image width
                            'height' => 200, //image heght
                        ]
                    ],
                ],
                'options'       => []
            ]
        ]);

```

Widget fields are meant for widget main information. For example, title. Item fields are meant for items which will be stored in widget. You can store multiple items in one widget. You can customize widget options, available options:

```
'options'       => [
    'frontend_template'   => 'widgets.text_with_title.frontend', // by default "widgets.{widget_name}.frontend"
    'backend_template'    => 'content::module_content.widgets.widget_blocks.backend',
    'backend_with_border' => false, // Depends on what kind of backend_template you have
    'backend_javascript'  => 'widget_blocks.js',
    'javascript_key'      => 'widget_blocks',
    'backend_css'         => 'widget_blocks.css',
    'is_empty'            => false,
    'content'             => 'This text is shown when widget has no input data'
    'has_template'        => true,
    'backend_worker'      => \Modules\Content\Widgets\BackendWorkers\WidgetBlock::class,
    'max_items_count'     => 1, // put "0" if you want to allow unlimmited amount of items
]

```

You can create empty widget, which won't be configurable from Content section in admin panel, but you can display any data in frontend template. This is useful if you want to display forum thread list. Here is an example widget:

```
content()->storeWidgets([
    'Forum threads' => [
        'is_enabled'    => 1,
        'options' => [
            'is_empty' => true,
            'content' => 'This widget is configurable from Forum section'
        ]
    ]
]);

```

2. In most cases you will want to customize name, key, frontend\_template, javascript\_key, backend\_worker and fields. However, in most cases your will not customize backend\_template and backend\_worker. These are usually universal.
3. Create template that you specified as `frontend_template` in step one.
4. All done. Backend is generated automatically.

Creating pages and seeding widget content
-----------------------------------------

[](#creating-pages-and-seeding-widget-content)

You can seed multiple pages per channel. By default there is always default channel (Main) which contains static pages, but there is cases where you would want to create another channel for News.

Below there is an example for seeding pages per channel

```
  content()->storePages([
            'static'   => [
                [
                    'name'        => 'Home page',
                    'layout'      => 'layouts.main',
                    'is_active'   => 1,
                    'is_homepage' => 1,
                    'data'        => $homepageData
                ]
            ],
            'news' => [
                // news pages
            ],
        ]);

```

$homepageData looks like

```
$homepageData = [
            'widgets'     => [
                [
                    'widget'     => 'Employees widget',
                    'main_items' => [
                        'block_title'       => 'Get to know our employees',
                        'block_description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam consequatur, esse libero omnis sapiente sequi sint sit totam. Magni, ratione.',
                    ],
                    'items'      => [
                        [
                            'name'        => 'John Doe',
                            'job_title'   => 'Backend developer',
                            'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque, quam?',
                            'picture'     => resource_path('seed_widgets/employees_widget/1.jpg')
                        ],
                        [
                            'name'        => 'Doe John',
                            'job_title'   => 'Backend developer 2',
                            'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque, quam? 2',
                            'picture'     => resource_path('seed_widgets/employees_widget/2.jpg')
                        ],
                    ]
                ]
            ],
            'attachments' => [ // optional, used for news channel
                resource_path('seed_widgets/articles_images/1.jpg'),
                resource_path('seed_widgets/articles_images/2.jpg'),
            ],
            'entry_data'  => [ // optional, used for news channel
                'article_content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusamus ad aperiam architecto consequuntur corporis cum dignissimos dolorem doloribus, ea earum eius enim error esse fugit hic id illum impedit, labore minus mollitia necessitatibus non obcaecati optio placeat quas quasi quia quod similique sit sunt suscipit temporibus, tenetur ut voluptas voluptate voluptatum! Alias dolores ea eaque eos eveniet, explicabo facilis ipsam iste nemo nobis optio placeat quae reprehenderit rerum tempore totam vero? Ipsam laboriosam nostrum officia perferendis quidem similique sunt! Adipisci architecto asperiores cum, ducimus, facere facilis id itaque nobis nostrum officia omnis repellat rerum soluta vel, veniam vero voluptatibus.'
            ]
        ];

```

Adding a new channel
--------------------

[](#adding-a-new-channel)

If you want to create new channels, for example, you may want to create news channel where you would store news articles.

```
$channels = content()->storeChannels([
            [
                'layout'            => 'layouts.main',
                'is_active'         => 1,
                'slug'              => 'news',
                'name'              => 'News',
                'allow_attachments' => 1, // attachments may be used for storing pictures of news
                'fields'            => [ // may add multiple fields, for example "Author"
                    'Article content' => [
                        'type' => 'textarea',
                    ],
                    'Vote count' => [
                        'type'      => 'text',
                        'is_global' => 1 //Channel entries will have global fields, which won't be translateable
                    ],
                ]
            ],
        ]);

```

However, you need to configure and create a template for each of your channels in `config/netcore/module-content.php`

Template file looks like this

```
{{ $contentBlock->field['title'] }} //get main fields
{{ $widgetBlock->items->sortBy('order') }} //get widget items collection
{{ $item->field['title'] }} // To get specific item from widget item
{{ $page->global_field['author'] }} // to get global channel field

```

Main information about versions
-------------------------------

[](#main-information-about-versions)

0.1 branch contains initial version of package. It has very limited multi-language support and it is mainly intended for use in not-translatable websites.

1.0 properly supports translatable websites. SimpleText and ImageBlocks widgets are deleted in favor of more universal WidgetBlock widget. Additionally, fields for widget items are no longer stored as JSON.

2.0 TODO

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 58% 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.

###  Release Activity

Cadence

Every ~3 days

Total

88

Last Release

2836d ago

Major Versions

v0.1.1 → v1.0.02017-11-03

v0.1.2 → v1.0.12017-11-03

v0.1.7 → v1.0.22017-12-01

v1.1.9 → v2.0.02018-02-11

PHP version history (2 changes)v0.0.1PHP &gt;=5.6.4

v0.1.1PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![danielsGrietins](https://avatars.githubusercontent.com/u/24427373?v=4)](https://github.com/danielsGrietins "danielsGrietins (51 commits)")[![dmitrijsmihailovs](https://avatars.githubusercontent.com/u/6555569?v=4)](https://github.com/dmitrijsmihailovs "dmitrijsmihailovs (25 commits)")[![janisblaus](https://avatars.githubusercontent.com/u/1029697?v=4)](https://github.com/janisblaus "janisblaus (8 commits)")[![gstvr](https://avatars.githubusercontent.com/u/13051632?v=4)](https://github.com/gstvr "gstvr (2 commits)")[![NViktors](https://avatars.githubusercontent.com/u/26169825?v=4)](https://github.com/NViktors "NViktors (1 commits)")[![speekadievs](https://avatars.githubusercontent.com/u/13509181?v=4)](https://github.com/speekadievs "speekadievs (1 commits)")

### Embed Badge

![Health badge](/badges/netcore-module-content/health.svg)

```
[![Health](https://phpackages.com/badges/netcore-module-content/health.svg)](https://phpackages.com/packages/netcore-module-content)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[laravolt/avatar

Turn name, email, and any other string into initial-based avatar or gravatar.

2.0k5.4M31](/packages/laravolt-avatar)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[aimeos/aimeos-core

Full-featured e-commerce components for high performance online shops

4.5k346.9k48](/packages/aimeos-aimeos-core)[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[yajra/laravel-datatables-buttons

Laravel DataTables Buttons Plugin.

2629.1M54](/packages/yajra-laravel-datatables-buttons)

PHPackages © 2026

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