New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

sukohi/custom-cast

A Laravel package for custom casts.
24 1

Larablocks Analysis

sukohi/custom-cast works with Laravel 5 (latest release 1.0.2, Aug 16, 2017), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: Aug 16, 2017)
  • 0 downloads a month (needs 10,000)
  • 1 GitHub star (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Aug 16, 2017.
  • No releases in the last 12 months.
  • First released: Jul 31, 2017.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.

Install
composer require sukohi/custom-cast
Latest Version:1.0.2
Laravel:5
Last Updated:Aug 16, 2017
Links: GitHub  ·  Packagist
Maintainer: Sukohi

CustomCast

A Laravel package for custom casts.

Installation

Execute composer command.

composer require sukohi/custom-cast:1.*

Preparation

Simple Way

In your model, set CustomCastTrait and add $casts as usual.

<?php

namespace App;
use Sukohi\CustomCast\CustomCastTrait;

class User {

    use CustomCastTrait;
    
    protected $casts = [
        'column' => 'CUSTOM-CAST-NAME'
    ];

Now you can use custom casts.

Alphabet boolean

  • true <=> 'T'
  • false <=> 'F'

You need to set alpha_boolean.
This might be useful for JavaScript Object key.

protected $casts = [
    'activated' => 'alpha_boolean'
];

Alphabet ternary

  • 1 <=> 'T'
  • 2 <=> 'F'
  • 0 <=> 'U' (unknown)

You need to set alpha_ternary.

protected $casts = [
    'status_type_id' => 'alpha_ternary'
];

Short time

  • hh::ii:ss => hh:ii

    protected $casts = [ 'meeting_time' => 'short_time' ];

    // i.g) 01:02:03 => 01:02

License

This package is licensed under the MIT License.

Copyright 2017 Sukohi Kuhoh

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released Laravel License
1.0.2 ~5.0
1.0.1 ~5.0
1.0.0 ~5.0