Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Prepare version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmccallister committed Apr 27, 2016
1 parent 450635c commit 0608218
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1,132 deletions.
70 changes: 69 additions & 1 deletion CollectionsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,101 @@

class CollectionsPlugin extends BasePlugin
{
/**
* CollectionsPlugin constructor.
*/
public function __construct()
{
require_once 'vendor/autoload.php';
}

/**
* Define the plugins name
*
* @return string
*/
public function getName()
{
return 'Collections';
}

/**
* Define the plugins description
*
* @return string
*/
public function getDescription()
{
return 'Use Laravel Collections in Craft Plugins.';
}

/**
* Define the plugins version
*
* @return string
*/
public function getVersion()
{
return '1.0.0';
return '0.1.0';
}

/**
* Define the schema version
*
* @return string
*/
public function getSchemaVersion()
{
return '1.0.0';
}

/**
* URL to releases.json
*
* @return string
*/
public function getReleaseFeedUrl()
{
return 'https://raw.githubusercontent.com/venveo/craft-collections/master/releases.json';
}

/**
* Documentation URL
*
* @return string
*/
public function getDocumentationUrl()
{
return 'https://github.com/venveo/craft-collections';
}

/**
* Get the Developer
*
* @return string
*/
public function getDeveloper()
{
return 'Venveo';
}

/**
* Define the developers website.
*
* @return string
*/
public function getDeveloperUrl()
{
return 'https://www.venveo.com';
}

/**
* Get the settings template.
*
* @return string
*/
public function getSettingsHtml()
{
return craft()->templates->render('collections/settings');
}
}
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use Laravel Collections in Craft CMS Plugins

Collections is a really powerful 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](http://adamwathan.me/refactoring-to-collections/)" and he also has a [great screencast on using collectons](http://adamwathan.me/2015/01/01/refactoring-loops-and-conditionals/)..
[Collections is a really powerful Laravel class](https://laravel.com/docs/master/collections) 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](http://adamwathan.me/refactoring-to-collections/)" and he also has a [great screencast on using collectons](http://adamwathan.me/2015/01/01/refactoring-loops-and-conditionals/)..

There are often times when we are working with Craft CMS and wish we had Collections support, so we decied to build this plugin!

Expand All @@ -24,7 +24,7 @@ $array = [
];
```

You can easily create the array to a Collection using the following code:
You can easily make the array a Collection using the following code:

```
$collection = craft()->collections->make($array);
Expand All @@ -40,7 +40,15 @@ For example you can get the count of items in the array/Collection by simply cal

Wham-o! the count, in this case `4`, will be easily available!

For the complete list of options when using Collections, read the [Laravel documentation](https://laravel.com/docs/master/collections#available-methods).
What if you need to ensure that an array contains and item?

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

For the complete list of options when using Collections, see the list of [available methods](https://laravel.com/docs/master/collections#available-methods).

## Credits

Expand Down
8 changes: 7 additions & 1 deletion releases.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[
{

"version": "0.1.0",
"downloadUrl": "https://github.com/venveo/craft-collections/archive/v0.1.0.zip",
"date": "2016-26-04 10:00:00",
"notes": [
"# Initial Release",
"[Added] Use Laravel Collections in Craft Plugins"
]
}
]
Loading

0 comments on commit 0608218

Please sign in to comment.