karkowg / laravel-bit-flag
This package is abandoned and no longer maintained.
No replacement package was suggested.
Laravel support for karkowg/bit-flag
Fund package maintenance!
karkowg
v1.0.0
2022-04-26 21:24 UTC
Requires
- php: ^7.4
- illuminate/contracts: ^8.0
- karkowg/bit-flag: ^1.1.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^v5.11.0
- nunomaduro/larastan: ^1.0.3
- orchestra/testbench: ^v6.24.1
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
README
Laravel BitFlag
This package provides Laravel support for karkowg/bit-flag.
Requires PHP 7.4 and Laravel 8.x
⚡️ Installation
composer require karkowg/laravel-bit-flag
Usage
<?php namespace App\BitFlags; use Karkow\BitFlag\Laravel\BitFlag; class CartStatus extends BitFlag { private const CHECKED_OUT = 1 << 0; private const PAYED = 1 << 1; private const SHIPPED = 1 << 2; // ... other setters/getters public function markAsPayed(): self { return $this->set(self::PAYED); } public function hasBeenPayed(): bool { return $this->has(self::PAYED); } } // App\Services\CartService $cartStatus = CartStatus::make(); if ($paymentSuccessful) { $cartStatus->markAsPayed(); } $cartStatus->hasBeenPayed(); //? true
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.