PHPackages                             glioympas/constella - 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. glioympas/constella

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

glioympas/constella
===================

Locate database columns usage in a matter of seconds

1.4.0(7mo ago)244MITPHPPHP ^8.4

Since Sep 26Pushed 7mo agoCompare

[ Source](https://github.com/glioympas/constella)[ Packagist](https://packagist.org/packages/glioympas/constella)[ RSS](/packages/glioympas-constella/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (5)Used By (0)

Enhance searchability - locate database columns in a matter of seconds
======================================================================

[](#enhance-searchability---locate-database-columns-in-a-matter-of-seconds)

---

What it does?
-------------

[](#what-it-does)

Constella will automatically publish your DB columns as public PHP constants after every successful regular Laravel php artisan migrate execution.

In addition to that, you may also want to follow same logic on Model relations too and have them as constants. You can simply generate them with an artisan command.

**Note**: This is mostly to be used for your new projects, since it can get quite cumbersome to refactor your current ones to follow that logic.

What this is about?
-------------------

[](#what-this-is-about)

Wouldn't it be great for your developers, no matter if they are new to the project, or have been there for some time already, to be able to find where a specific DB column or relation is being used on the codebase, super fast?

Think of it, that's extremelly powerful since almost everything is around data.

That means:

- Faster &amp; painless bug fixes
- Faster &amp; painless code refactorings
- New comers can ship faster
- Consistency &amp; enhanced searchability

And in general, more confidence on finding where things are being used in a large (or not) codebase.

### Example that describes the problem

[](#example-that-describes-the-problem)

Your project is a large SaaS application and your new developer needs to do some refactoring on a column named 'title' on a Project model.

Now the developer must find where this column is being used, probably exploring different files or globally searching on the IDE for things like:

```
$project->title

```

```
where('title')

```

```
whereTitle

```

After finding some on different files, person just wishes that to be all. That simple task was almost already pain in the ass. The larger the codebase, the worse it gets. The developer experience can get better IMO.

### A solution to the above problem

[](#a-solution-to-the-above-problem)

You have a policy / coding standard on your codebase and you don't allow developers to use magic strings for DB columns or even relations. Developers should only use regular PHP constants.

The above developer now just searches for

```
ProjectColumn::TITLE

```

and immediately finds all the places where title columns is being used in a matter of seconds!

The trick here is to treat it as a strict code policy and see the long term benefits of this.

### Specifically

[](#specifically)

You **DON'T** using magic string for your columns, for example:

```
$project->title = 'something'

```

```
Project::query()->where('title', ...)

```

```
Task::query()->whereRelation('project', 'title', '=' ....)

```

You **FORCE** your developers (on code reviews for example) to use constants:

```
$project->{ProjectColumn::TITLE} =

```

```
$project->setAttribute(ProjectColumn::TITLE, '...')

```

```
Project::query()->where(ProjectColumn::TITLE, '...')

```

```
Task::query()->whereRelation('project', ProjectColumn::TITLE', '=' ....)

```

In the beginning that may be a bit weird to type, but you get used to it very fast and the long term benefits for the project really worth it IMO.

Installation &amp; usage
------------------------

[](#installation--usage)

You can install the package via composer:

```
composer require glioympas/constella
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Lioy\Constella\ConstellaServiceProvider" --tag="config"
```

Constella will automatically publish column classes on the same root folder where your models exist.

This will happen after a successful regular migration using:

```
php artisan migrate (or migrate:rollback)

```

For **first time** usage, if you don't have an migration to execute, you can publish them using the following command:

```
php artisan constella:columns

```

### Also need Model relations constants?

[](#also-need-model-relations-constants)

Want to also have model relations as constants too? You can generate them with the following command on first time usage or after each time you add a new relation

to your models:

```
php artisan constella:relations

```

**Note**: To allow Constella locate the relations, your relation functions on Eloquent models should be type-hinted!

Then you can force a policy for your developers to use relations like that:

```
Task::query()->whereRelation(TaskRelation::PROJECT, ProjectColumn::TITLE, '=', '....)

```

```
$task->{TaskRelation::PROJECT}->title

```

```
Task::query()->whereHas(TaskRelation::PROJECT, fn() => ... )

```

License
-------

[](#license)

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

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance64

Regular maintenance activity

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~1 days

Total

4

Last Release

222d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d3562fff5d95b1997673975ab1fa393d25361233622f186f0b4887680233a82?d=identicon)[glioympas](/maintainers/glioympas)

---

Top Contributors

[![glioympas](https://avatars.githubusercontent.com/u/43645495?v=4)](https://github.com/glioympas "glioympas (11 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/glioympas-constella/health.svg)

```
[![Health](https://phpackages.com/badges/glioympas-constella/health.svg)](https://phpackages.com/packages/glioympas-constella)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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