PHPackages                             ngiraud/posttype-management - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ngiraud/posttype-management

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ngiraud/posttype-management
===========================

Add or remove a simple posttype configuration to your Laravel application.

1.1.1(7y ago)121MITPHPPHP &gt;=7.0

Since Feb 13Pushed 7y ago2 watchersCompare

[ Source](https://github.com/ngiraud/posttype-management)[ Packagist](https://packagist.org/packages/ngiraud/posttype-management)[ Docs](https://github.com/ngiraud/posttype-management)[ RSS](/packages/ngiraud-posttype-management/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (7)Versions (5)Used By (0)

PostType Management
===================

[](#posttype-management)

This package allows you to add or remove a simple "posttype" configuration to your Laravel application.

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

[](#installation)

### Prerequisites

[](#prerequisites)

- This package can be used in Laravel 5.4 or higher

### Step 1

[](#step-1)

You can install the package via composer:

```
composer require ngiraud/posttype-management
```

### Step 2

[](#step-2)

In Laravel 5.5 the service provider will automatically get registered. In older versions just add the service provider in the config/app.php file:

```
'providers' => [
    // ...
    NGiraud\PostType\PostTypeServiceProvider::class,
];
```

Usage
-----

[](#usage)

### Create a post type

[](#create-a-post-type)

This command will create a model, resource controller, migration and factory into your Laravel project.

It will also add a route in the routes/web.php file.

```
php artisan posttype:create MYPOSTTYPE [-m|--migrate] [--ctrl-folder=MYFOLDER]
```

If you want to specify a custom path to your Controller directory inside the App/Http, you can use:

```
php artisan posttype:create MYPOSTTYPE --ctrl-folder=MYFOLDER
```

The route will be namespaced with the folder name.

If you want to migrate the generated migration instantly:

```
php artisan posttype:create MYPOSTTYPE -m
```

### Remove a post type

[](#remove-a-post-type)

This command will remove the model, resource controller, migration and factory from your Laravel project.

```
php artisan posttype:remove MYPOSTTYPE
```

!!! The associated route will not be removed !!!

### Columns

[](#columns)

The default columns added to a post type are:

```
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedInteger('parent_id')->nullable();
$table->string('name');
$table->string('slug');
$table->unsignedTinyInteger('status');
$table->text('excerpt')->nullable();
$table->longText('content')->nullable();
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->softDeletes();
```

The package uses softDeletes columns.

The user\_id column is automatically saved in the model boot event saving with the authenticated user id.

The published\_at column is automatically saved as well as the user\_id if the status is published.

Default comportment
-------------------

[](#default-comportment)

Post types queries have a global scope to only fetch published data.

A relationship exists between a user and the posttype called owner(). Two relationships exist between a posttype parent and a posttype children :

- The first one is parent();
- The second one is children();

A public function "rules" exists, you can override it if you want.

To add another status you just have to add a constant in the model called STATUS\_MYNEWSTATUS :

Credits
-------

[](#credits)

- Nicolas Giraud

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

2854d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12152071?v=4)[Nicolas Giraud](/maintainers/ngiraud)[@ngiraud](https://github.com/ngiraud)

---

Top Contributors

[![ngiraud](https://avatars.githubusercontent.com/u/12152071?v=4)](https://github.com/ngiraud "ngiraud (24 commits)")

---

Tags

laravelwordpressPostTypengiraud

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ngiraud-posttype-management/health.svg)

```
[![Health](https://phpackages.com/badges/ngiraud-posttype-management/health.svg)](https://phpackages.com/packages/ngiraud-posttype-management)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)

PHPackages © 2026

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