PHPackages                             fatihirday/suffix - 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. fatihirday/suffix

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

fatihirday/suffix
=================

laravel migration suffixed tables

v0.1.4(1y ago)215MITPHPPHP ^7.4|^8.0

Since Mar 1Pushed 1y ago2 watchersCompare

[ Source](https://github.com/fatih-irday-01/migration-suffix)[ Packagist](https://packagist.org/packages/fatihirday/suffix)[ RSS](/packages/fatihirday-suffix/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (5)Used By (0)

[![Laravel Suffix](./laravel_suffix.jpg)](./laravel_suffix.jpg)

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

[](#installation)

1. Run composer command to install the package

```
composer require fatihirday/suffix
```

2. Publish the config and migration files.

```
php artisan vendor:publish --provider="Fatihirday\Suffixed\SuffixServiceProvier"
```

- Response

```
* config/suffixed.php
* migrations/*_create_suffixes_table.php

```

3. To use the suffix list in the package

```
php artisan migrate
```

If you are going to use your own list, you can delete the file `migrations/*_create_suffixes_table.php`

Configuration
-------------

[](#configuration)

1. Config suffixed File

```
return [
    'suffixes' => [
        'table' => \Fatihirday\Suffixed\Models\Suffix::class,
        'column' => 'code',
        'auto_create_suffixed_tables' => true,
    ],

    'suffix_auto_check' => true,

    'merge_operator' => '_',

    'suffix_max_length' => 3,
];
```

ConfigDes`suffixes.table`suffix list table`suffixes.code`suffix column`suffixes.auto_create_suffixed_tables`Automatically create suffixes tables when new record is added to `suffixes.table` table`suffix_auto_check`When it wants to work on the attached table, it automatically checks the table.`merge_operator`table name and suffix merge operator`suffix_max_length`suffix max length. use `null to be unlimited2. Suffix Model

```
class Suffix extends Model
{
    use HasFactory, SuffixList;
}
```

`use SuffixList;` for custom model.

Examples
--------

[](#examples)

### Make migration

[](#make-migration)

#### 1. Insert row to suffixes table

[](#1-insert-row-to-suffixes-table)

```
php artisan tinker
```

```
$row = new \Fatihirday\Suffixed\Models\Suffix();
$row->name = 'Fatih';
$row->code = 'fth';
$row->save();
```

#### 2. Make migration suffixed

[](#2-make-migration-suffixed)

```
php artisan make:migration-suffix CreateDemoTable
```

```
class CreateDenemeTable  extends SuffixMigration implements SuffixSchame
{
    protected $baseTableName = 'demo';

    public function upSuffix(string $tableName, string $prefix)
    {
        Schema::create($tableName, function (Blueprint $table) use ($prefix)  {
            $table->id();
            $table->string('name', 30);
            $table->timestamps();
        });
    }

    public function downSuffix(string $tableName, string $prefix)
    {
        Schema::dropIfExists($tableName);
    }
}
```

#### 3. Run the migrate

[](#3-run-the-migrate)

```
php artisan migrate
```

Created table `demo_fth`

#### 4. Make Model

[](#4-make-model)

Use Suffixed in your model to access suffixed tables

```
class Demo extends Model
{
    use HasFactory, Suffixed;
}
```

### Use of suffix table

[](#use-of-suffix-table)

#### Check suffixed table

[](#check-suffixed-table)

```
App\Models\Demo::checkSuffixCode('fth');
// Response : true || false
```

#### Set suffix code

[](#set-suffix-code)

```
App\Models\Demo::setSuffixCode('fth')->toSql();
// Response : "select * from `demo_fth`"
```

#### Get suffixed table name

[](#get-suffixed-table-name)

```
App\Models\Demo::setSuffixCode('fth')->getTable();
// Response : "demo_fth"
```

#### Get suffixed table suffix code

[](#get-suffixed-table-suffix-code)

```
App\Models\Demo::setSuffixCode('fth')->getSuffixCode();
// Response : "fth"
```

#### example query

[](#example-query)

```
// insert row to demo_fth table
$newRow = App\Models\Demo::setSuffixCode('fth');
$newRow->name = 'deneme';
$newRow->save();

// get rows to demo_fth table
App\Models\Demo::setSuffixCode('fth')->whereNotNull('name')->get();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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 ~300 days

Total

4

Last Release

683d ago

PHP version history (2 changes)v0.1.0PHP ^7.3|^8.0

v0.1.1PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5274e19713d1f1accb92e38f6fb40430b3fb99c272088317b1064a526622ac70?d=identicon)[fatihirday](/maintainers/fatihirday)

---

Top Contributors

[![fatih-irday-01](https://avatars.githubusercontent.com/u/57077274?v=4)](https://github.com/fatih-irday-01 "fatih-irday-01 (10 commits)")[![fatihirdayTeknasyon](https://avatars.githubusercontent.com/u/170324551?v=4)](https://github.com/fatihirdayTeknasyon "fatihirdayTeknasyon (1 commits)")

### Embed Badge

![Health badge](/badges/fatihirday-suffix/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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