2017 © Pedro Peláez
 

craft-plugin craft-collections

Use Laravel Collections in Craft CMS Plugins

image

venveo/craft-collections

Use Laravel Collections in Craft CMS Plugins

  • Monday, October 24, 2016
  • by jasonmccallister
  • Repository
  • 6 Watchers
  • 8 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Use Laravel Collections in Craft CMS Plugins

Collections is a really powerful Laravel class that provides "a fluent, convenient wrapper for working with arrays of data". Don't just take our words for it, Adam Watham is working on a book called "Refactoring to Collections" and he also has a great screencast on using collections.., (*1)

There are often times when we are working with Craft CMS and wish we had Collections support, so we decided to build this plugin!, (*2)

Requirements

Installation and Setup

  1. Download plugin release from this page
  2. Rename the download directory to collections and move into your plugins directory
  3. Install Collections from the control panel settings

Example Usage

When working with data that is in an array..., (*3)

$array = [
    'eight', 'six', 'seven', 'five'
];

You can easily make the array a Collection using the following code:, (*4)

$collection = craft()->collections->make($array);

Once you have your data in a Collection, you can instantly reap the rewards!, (*5)

For example you can get the count of items in the array/Collection by simply calling:, (*6)

$collection->count();, (*7)

Wham-o! the count, in this case 4, will be easily available!, (*8)

What if you need to ensure that an array contains and item?, (*9)

if ($collection->contains('six')) { // returns true, then do something about it! }, (*10)

For the complete list of options when using Collections, see the list of available methods., (*11)

Credits

About Venveo

Venveo is a Digital Marketing Agency for Building Materials Companies in Blacksburg, VA. Learn more about us on our website., (*12)

License

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

The Versions

24/10 2016

dev-add-twig-extension-support

dev-add-twig-extension-support

Use Laravel Collections in Craft CMS Plugins

  Sources   Download

The Requires

 

by Jason McCallister

24/10 2016

dev-master

9999999-dev

Use Laravel Collections in Craft CMS Plugins

  Sources   Download

The Requires

 

by Jason McCallister

28/04 2016

v1.0.0

1.0.0.0

  Sources   Download

The Requires

 

27/04 2016

v0.1.0

0.1.0.0

  Sources   Download

The Requires