This repository was archived by the owner on Mar 12, 2024. It is now read-only.

michael-rubel/laravel-loop-functions

Repository files navigation

Laravel Loop Functions

Latest Version on PackagistTotal DownloadsCode QualityCode CoverageGitHub Tests Action StatusPHPStan

The package provides the collection of methods to loop over your data.

The package requires PHP 8 or higher and Laravel 9 or higher.

SWUbanner

Install the package using composer:

composer require michael-rubel/laravel-loop-functions
use LoopFunctions;
$this->propertiesFrom($model);
$this->propertiesFrom($array);

If you want to use dynamic properties, adjust the dynamic_properties key in the config and add the following trait if your class is not already implementing the get/set magic methods:

use WithDynamicProperties;

Note: if you use the Livewire components, it already has similar definitions under the hood.

$this->dumpProperties();

By default, the package ignores id and password properties to avoid conflicts in Livewire/auth components. You can customize the ignore list by editing the config.

php artisan vendor:publish --tag="loop-functions-config"

The functions don't throw an exception in case of failed assignment (e.g. type incompatibility) but log such an event. You can disable exception logging if you wish so in the config.

composer test

The MIT License (MIT). Please see License File for more information.

About

Collection of helper functions

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

    Languages