PHPackages                             czim/laravel-pxlcms - 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. [Database &amp; ORM](/categories/database)
4. /
5. czim/laravel-pxlcms

ActiveLibrary[Database &amp; ORM](/categories/database)

czim/laravel-pxlcms
===================

Laravel adapter for the PXL CMS

1.3.0(6y ago)31.6k1MITPHPPHP &gt;=5.6.4CI failing

Since Oct 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/czim/laravel-pxlcms)[ Packagist](https://packagist.org/packages/czim/laravel-pxlcms)[ Docs](https://github.com/czim/laravel-pxlcms)[ RSS](/packages/czim-laravel-pxlcms/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (10)Versions (34)Used By (1)

Laravel PXL CMS Adapter
=======================

[](#laravel-pxl-cms-adapter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/57aa32c59763eef911e1c18f8540008690a2f6979f22f271fe3d47256fcf938d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637a696d2f6c61726176656c2d70786c636d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/czim/laravel-pxlcms)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/2969f2566abfe0a5fc772f2b2e60e1030244f49b1374dee4c21f89cb3eccb727/68747470733a2f2f7472617669732d63692e6f72672f637a696d2f6c61726176656c2d70786c636d732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/czim/laravel-pxlcms)[![Latest Stable Version](https://camo.githubusercontent.com/b42c6a7ded32debe52c3dfb7bb4e2961f49a477ad0ec2d7e47a7b76b2356e07f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637a696d2f6c61726176656c2d70786c636d732e737667)](https://packagist.org/packages/czim/laravel-pxlcms)

PXL CMS Adapter for Laravel.

Version Compatibility
---------------------

[](#version-compatibility)

LaravelPackage5.1.x1.1.x5.2.x1.2.x5.3.x1.3.xInstall
-------

[](#install)

Via Composer

```
$ composer require czim/laravel-pxlcms
```

Add this line of code to the providers array located in your `config/app.php` file:

```
    Czim\PxlCms\PxlCmsServiceProvider::class,
```

Publish the configuration:

```
$ php artisan vendor:publish
```

Workflow
--------

[](#workflow)

1. Generate CMS content
2. Install and set up new Laravel project and connect it to the CMS database
3. Install this package
4. Configure this package
5. Run the generator: `artisan pxlcms:generate`

Using Models
------------

[](#using-models)

Generated Models work, for the most part, exactly like normal Eloquent Models. This includes relationships, updating, eager loading and so forth. There are a few caveats:

- Foreign keys in CMS tables have the name of the property. They are named 'category', for instance, not 'category\_id'.
    - This means that using `$model->category` on an unloaded relationship will **not** trigger the magic property since the attribute is present. You will get the ID integer instead. To get around this, simply call the relation method itself (ie. `$model->category()->first()`).
- By default, all models are globally scoped to only include *active* records (`e_active = true`).
    - If you want to include inactive records, use the `withInactive()` scope (ie. something like `ModelName::withInactive()->get()`).
    - This depends on your pxlcms config settings, the behaviour may be changed.
- By default, all models are ordered by their *position* (`e_position asc`).
    - If you want to prevent this, use the `unordered()` scope (ie. something like `ModelName::unordered()->first()`).
    - This depends on your pxlcms config settings, the behaviour may be changed.

Features and Traits
-------------------

[](#features-and-traits)

- For multilingual support, **translatable** is used. This offers the same functionality, but uses an adapter trait that uses the CMS ..\_ml table content.
- By default, **rememberable** is added to every model, allowing you to cache queries with the `->remember()` method on any Eloquent Builder instance for the models.
- **Listify** is used to handle the position column on the model. You should probably let the CMS handle things, but if you need it, it is available.
- For slug handling **sluggable** is provided, through an adapter trait that uses the commonly used approach of using a `cms_slugs` table.

See the configuration file for ways to change or disable the above.

Images and Uploads
------------------

[](#images-and-uploads)

Image and File fields are set up as special relationships on the generated model. If you use the magic property for the relationship on the model, like so:

```
  // For a model with a relationship: images() to the CMS Image model
  $model->images
```

... then the image results will be enriched with information about resizes and the external URLs to the images or files.

```
   $image = $model->images->first();

   // This will return the external URL to the (base) image
   $image->url

   // This will return the local path to the file
   $image->localPath

   // This will list all resizes with appended prefixes and full URLs
   $image->resizes
```

Saving images will work, but will not affect resizes. Note that Laravel leaves you free to update the Image model's records with nonexistant files. Additionally, no resize files will be generated for any fresh images this way.

Note that this will work for *translated* images and uploads. Relationships will only return results for the current locale. The locale used may be overridden (generated model code allows this by default):

```
   // Return image results for locale other than the active application locale
   $englishImage = $model->images('en')->first();
   $dutchImage   = $model->images('nl')->first();
```

Slugs
-----

[](#slugs)

A modified version of the [Sluggable](https://github.com/cviebrock/eloquent-sluggable) Eloquent model trait is used to handle slugs for the models that were 'sluggified' during model generation. This works mostly like the original Sluggify, with some exceptions:

- Slugs may be stored in the `cms_slugs` table (which can be defined in the generator config). If so, the change is transparent when using Sluggable methods.
- Route model binding should work just find, look it up in the Sluggable documentation.
- The `findBy` method is now expanded with an optional `locale` parameter, wich limits slug searches to a specific locale/language: `findBy($slug, $locale = null)`. Likewise, the `whereSlug` scope has an optional `locale` parameter.
- Translation models should be made Sluggable for multilingual slugs. The translation's parent model will still implement the `SluggableInterface` and delegate the relevant calls to the translation model.

Running the Generator
---------------------

[](#running-the-generator)

The code generator is run through the Artisan command: `pxlcms:generate`. It will analyze the database CMS content, if it can find it, and generate code based on the `pxclms.php` config file.

The following options are available:

```
--auto      automatic mode, skips interactivity
--dry-run   performs analysis and outputs data without writing any files
 -v         verbose mode, shows debug output

```

To Do
-----

[](#to-do)

- low prio: defaults based on 'options' field column
    - and perhaps auto\_update for a timestamp replacement? use consts on the model to set the updated at timestamp attribute const UPDATED\_AT = 'date\_modified';

### Generator

[](#generator)

- detect typical cms\_m#\_languages table

    - configurable whether to automatically do this or interactively
    - create relation to cms\_languages if allowed, add by-locale lookups
- detect typical multilingual\_labels table

    - add locale-based methods / helpers
    - add Translation helper class / methods?

Things NOT taken into account
-----------------------------

[](#things-not-taken-into-account)

- Negative References (They do not get used; provide example if you find one).
- Custom Modules (They are skipped, since no reliable table information is available, if any are even used).
- Relationships with the same name as the foreign key attribute are not caught. Reasons not to touch this:
    1. It would be magic
    2. It would conflict with normal Eloquent usage
    3. It would be inefficient (would needs checks for EVERY access operation on the model)
- CMS-configured ordering on translated columns. For this, you'll have to construct your own preferred approach (with custom joins, f.i.). Ordering on a model for any column present on the table will work fine by default.

Credits
-------

[](#credits)

- [Coen Zimmerman](https://github.com/czim)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~53 days

Recently: every ~345 days

Total

33

Last Release

2208d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

1.2.1PHP &gt;=5.6.0

1.3.0PHP &gt;=5.6.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/1657b09521b6030fe32d864a493ded8b1dbbdf737ef3772135dfc123cea34767?d=identicon)[czim](/maintainers/czim)

---

Top Contributors

[![czim](https://avatars.githubusercontent.com/u/11831617?v=4)](https://github.com/czim "czim (2 commits)")

---

Tags

laraveldatabaseeloquentcms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/czim-laravel-pxlcms/health.svg)

```
[![Health](https://phpackages.com/badges/czim-laravel-pxlcms/health.svg)](https://phpackages.com/packages/czim-laravel-pxlcms)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

592456.3k2](/packages/spiritix-lada-cache)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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