laymont/shicontstand

Package for ISO 6346 shipping container codes management

Maintainers

Package info

github.com/laymont/Shicontstand

Homepage

pkg:composer/laymont/shicontstand

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

v1.2.0 2026-04-28 16:44 UTC

README

Latest Version on Packagist Total Downloads License: MIT

Package for ISO 6346 shipping container codes management. This package provides models, controllers, repositories, and resources for managing shipping container codes based on the ISO 6346 standard.

Compatibility

  • Laravel: ^12.0 | ^13.0
  • PHP: >=8.3

Installation

composer require laymont/shicontstand

Quick Start

  1. Publish and run migrations:
php artisan vendor:publish --tag="shicontstand-migrations"
php artisan migrate
  1. Seed data:
php artisan db:seed --class=ShicontstandSeeder

Usage

Models

The package includes 5 models for container codes:

  • TypeGroup - Container groups (Dry, Refrigerated, Open Top)
  • SizeType - Container sizes (20', 40', 45')
  • LengthCode - Length codes (L, M, E)
  • SizeCode - Size codes (2, G, L)
  • TypeCode - Type codes (G1, R1, etc.)

Repository Pattern

Use the repository for better testability and separation of concerns:

use Laymont\Shicontstand\Repositories\TypeGroupRepository;
use Laymont\Shicontstand\Models\TypeGroup;

$repository = new TypeGroupRepository(new TypeGroup());

// Get all
$groups = $repository->all();

// Get by code
$group = $repository->find('22G1');

// Query builder
$groups = $repository->query()->where('code', 'like', '2%')->get();

Controllers / API Endpoints

The package automatically registers routes:

GET /scs/type_groups
GET /scs/type_groups/{code}
GET /scs/size_types
GET /scs/size_types/{code}
GET /scs/length_codes
GET /scs/length_codes/{code}
GET /scs/size_codes
GET /scs/size_codes/{code}
GET /scs/type_codes
GET /scs/type_codes/{code}

Facade

use Shicontstand;

// Get all type groups
Shicontstand::getTypeGroups();

// Get specific type group
Shicontstand::getTypeGroup('20GP');

// Get all size types
Shicontstand::getSizeTypes();

// Get specific size type
Shicontstand::getSizeType('22G1');

In Controller

public function __construct(
    protected \Laymont\Shicontstand\Shicontstand $shicontstand
) {}

public function index()
{
    return $this->shicontstand->getTypeGroups();
}

Configuration

Publish config:

php artisan vendor:publish --tag="shicontstand-config"

Container Model Trait

Use the trait in your container model:

use Laymont\Shicontstand\Http\Concerns\ContainerValidation;

class Container extends Model
{
    use ContainerValidation;
}

This adds ISO 6346 validation attributes to your model.

Testing

./vendor/bin/pest

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests
  5. Submit a pull request

License

MIT License. See LICENSE.md for more information.

Donaciones

Si encuentras útil este paquete y deseas apoyar su desarrollo y mantenimiento, puedes considerar hacer una donación.

Zinli

Visa Prepagada Zinli

  • Número: 4850460061276928

Binance Pay

  • Binance Pay ID: 206414132

¡Gracias por tu apoyo!