damianulan/laravel-lucent

Lucent is a laravel extension package. It contains useful traits, helpers, macros, contracts and extensions such as Pipelines and Services.

Installs: 266

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/damianulan/laravel-lucent

1.1.2 2026-01-08 19:33 UTC

This package is auto-updated.

Last update: 2026-01-08 19:34:06 UTC


README

Static Badge   Licence   Static Badge

Description

Laravel Lucent is a package that provides a set of custom resources, components and traits for laravel projects and provides comprehensive support for popular design patterns (eg. pipelines services, repository pattern, builders).

Installation

You can install the package via composer in your laravel project:

composer require damianulan/laravel-lucent

The package will automatically register itself.

Next step is to publish necessary vendor assets.

php artisan vendor:publish --tag=lucent

Components

Traits

Helpers

clean_html

use Lucent\Helpers\clean_html;

clean_html('<script>alert("XSS");</script>'); // returns empty string

Uses mews/purifier package to clean HTML input off of possible XSS vulnerabilities. Best suited for cleaning before placing in rich text editors.

class_uses_trait

This helper function checks if trait is used by a target class. It recurses through the whole class inheritance tree.

class User extends Model
{
    use Accessible;
}

class UserController extends Controller
{
    public function index()
    {
        if (class_uses_trait(User::class, Accessible::class)) {
            // do something
        }
    }
}

Artisan Console Commands

Prune Soft Deletes

php artisan model:prune-soft-deletes

Schedule this command to periodically prune outdated records of models, that use Illuminate\Database\Eloquent\SoftDeletes and Lucent\Support\Traits\SoftDeletesPrunable traits.

$schedule->command('model:prune-soft-deletes')->daily();

In env file set PRUNE_SOFT_DELETES_DAYS to desired number of days after soft deleting, which records will be considered outdated.

Contact & Contributing

Any question You can submit to damian.ulan@protonmail.com.