Giter Club home page Giter Club logo

laravel-loop-functions-main's Introduction

Laravel Loop Functions

Laravel Loop Functions

Latest Version on Packagist Total Downloads Code Quality Code Coverage GitHub Tests Action Status PHPStan

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

The package requires PHP ^8.x and Laravel ^9.0.

Installation

Install the package using composer:

composer require michael-rubel/laravel-loop-functions

Usage

use LoopFunctions;

Assign Eloquent model attributes to class properties:

$this->propertiesFrom($model);

Assign array key values to class properties:

$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.

Dump class properties:

$this->dumpProperties();

Ignored property names

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"

Logging

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.

Testing

composer test

License

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

laravel-loop-functions-main's People

Contributors

shinyinight avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.