Download the PHP package stechstudio/laravel-record without Composer

On this page you can find all versions of the php package stechstudio/laravel-record. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-record

Laravel Record

Latest Version on Packagist Total Downloads

I'm going to assume you already know all about Laravel's awesome Collection class, and hopefully you've read Refactoring to Collections. (If you haven't, stop what you're doing and go buy that PDF. You'll thank me later.)

I also assume you know all about Eloquent models.

But have you ever wanted some of the functionality of a model, merged onto a collection?

This is a super small, single-class library that brings those together just a bit.

Benefits

Starting with the Collection class, I wanted to add:

1) Magic getter for attributes. If you have key/value pairs in your collection, the Collection class does provide the get method. But I'm lazy. And I like accessing my collection with plain 'ol object notation. You know, like a model. Record lets you do $collection->attribute.

2) New collection for sub-arrays. If you hand a multi-dimensional array to collect() and access a nested array, it's still just an array. Like $collection->get('attribute')['subattribute']. I want collections all the way down! This will turn any sub-array into a new instance of Record, allowing you to do $record->attribute->subattribute->as->deep->as->your->array->goes. And because you still have a real collection at each level, you can use all of the goodies like $record->attribute->subattribute->count().

3) Custom accessors. Just like Eloquent, you can extend the Record class and define a custom accessor. Create a getFooAttribute() method and then just use $collection->foo to get your custom computed attribute.

Quick example: handling rich arrays

I find myself frequently needing to handle a multi-dimensional array, often a response from a remote web service. This array may have attributes (like 'name' or 'id') as well as a nested collections (like 'data' or 'rows').

Consider this:

We can take this whole payload and navigate it quite nicely with Record:

Nice! At each level I get a combination Laravel's Collection class, plus some attribute goodness borrowed from Model.

Furthermore I might extend Record and create a class with custom accessors to sanitize content, or split the name into first and last, or... you get the idea.

Installation

You know the drill.

Then you can either:

Or you can use the record helper method:


All versions of laravel-record with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stechstudio/laravel-record contains the following files

Loading the files please wait ....