yaroslawww / laravel-thinkit
This package is abandoned and no longer maintained.
The author suggests using the think.studio/laravel-thinkit package instead.
Laravel small kit for quicker development.
1.4.0
2024-05-14 11:08 UTC
Requires
- php: ^8.1
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.17
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.0
- psalm/plugin-laravel: ^2.8
- vimeo/psalm: ^5.7
README
Laravel small kit for quicker development.
Installation
Install the package via composer:
composer require think.studio/laravel-thinkit
Optionally you can publish the config file with:
php artisan vendor:publish --provider="ThinKit\ServiceProvider" --tag="config"
Usage
Helpers
SQL
\ThinKit\Helpers\Sql::readableSqlFromQuery(MyModel::whereKey(123));
URL
\ThinKit\Helpers\Url::addOrUpdateArgs('https://my.path.co.uk?example=foo&test=bar', 'new', 'baz');
DateTime
$formats = [ 'Y-m-d', 'Y-m-d\TH:i:s', ]; $carbonDate = \ThinKit\Helpers\DateTime::createFromMultipleFormats($formats, '2022-09-28T08:19:00'); $carbonDate->format('Y-m-d H:i:s');
Enums
use ThinKit\Enums\HasNames; use ThinKit\Enums\NamedEnum; enum SalesCallType: string implements NamedEnum { use HasNames; case GENERAL = 'general'; case EVENT = 'event'; case AWARD = 'award'; } SalesCallType::GENERAL->name() // translation label SalesCallType::options() // ["<value>" => "<translation label>"] SalesCallType::formattedOptions() // [["value" => "<value>", "label" => "<translation label>"]]