2017 © Pedro Peláez
 

library laraparse

Integrate your Laravel 5 project with Parse (parse.com)

image

hipsterjazzbo/laraparse

Integrate your Laravel 5 project with Parse (parse.com)

  • Sunday, September 25, 2016
  • by HipsterJazzbo
  • Repository
  • 4 Watchers
  • 30 Stars
  • 4,209 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 8 Open issues
  • 18 Versions
  • 0 % Grown

The README.md

LaraParse

LaraParse provides a nice integration for using Parse (parse.com) with Laravel 5+., (*1)

Specifically, it, (*2)

  • Handles the registration and loading of the Parse SDK
  • Gives you an auth provider you can use to login and register using Parse
  • Provides a system for easily creating and registering subclasses, including an artisan generator and easy config
  • Provides generators and base classes for repositories

Future plans include, (*3)

  • Automatic generation of subclasses*
  • Docblock generation for subclasses*

* Depends on a schema API being released by Parse, (*4)

Installation

First, include LaraParse in your composer.json:, (*5)

composer require hipsterjazzbo/laraparse

Then load the service provider in your config/app.php:, (*6)

'LaraParse\ParseServiceProvider'

You'll also need to publish the config, so you can provide your keys:, (*7)

php artisan vendor:publish  --provider="LaraParse\ParseServiceProvider" --tag="config"

Usage

For general usage, you can just call the Parse SDK classes and methods like normal. See ParsePlatform/parse-php-sdk for more info., (*8)

$query = new ParseQuery('Class');
$query->equalTo('key', 'value');
$object = $query->first();

Auth Provider

LaraParse provides a driver for Laravel's built-in auth system to work with Parse. To use it, simply go to your config/auth.php and update the 'driver' key to 'parse', (*9)

You may then use Auth::attempt() and friends as normal., (*10)

Subclasses

Subclasses can make Parse a lot easier to work with. They save you from always dealing with generic ParseObjects, and provide you with a place to add helper methods and even use docblocks to get column auto-completion in your IDE., (*11)

You can generate a subclass like so:, (*12)

php artisan parse:subclass ClassName

It is assumed that ClassName is the same as the class within Parse, but if not you can use the --parse-class=ParseClass option to set it manually., (*13)

The subclass will be created within app/ParseClasses., (*14)

You must then register the subclass in your config/parse.php file., (*15)

Note: If you'd like to subclass the Parse User class, you should extend LaraParse\Subclasses\User, to ensure the Auth driver will still work., (*16)

Casting

Generated subclasses use the \LaraParse\Traits\CastsParseProperties trait, which tries to help you out a bit. It will:, (*17)

  • Change all Date columns into \Carbon\Carbon instances
  • Allow you to access built-in columns as properties (for instance, $class->objectId instead of $class->getObjectId())
  • Allow you to specify a method on your subclass with the same name as a Parse column, that will be called when accessing that column.

Repositories

LaraParse includes a few commands and base classes to assist with setting up repositories to use with Parse., (*18)

To generate a new repository, you can use the artisan command:, (*19)

php artisan parse:repository ClassName

Like subclasses, it is assumed that ClassName is the same as the class within Parse, but if not you can use the --parse-class=ParseClass option to set it manually., (*20)

By default, this command will generate both a contract and an implementation that extends an abstract base class, providing a full-featured repository that's ready to go., (*21)

If you'd rather just generate an implementation, you can use --which="implementation"., (*22)

See \LaraParse\Repositories\Contracts\ParseRepository to learn what methods are available., (*23)

If you want to bind the implementation to the contract you can populate the repositories array in the parse.php config (http://laravel.com/docs/5.0/container#binding-interfaces-to-implementations), (*24)

Using master key

If you need to use the master key for a query, you can do it like so:, (*25)

$repository = new ClassRepository();
$repository->userMasterKey(true)->all();

Thanks

Thanks a lot to @gfosco over at ParsePlatform/parse-php-sdk for helping deal with a few PRs that were neccessary for this package to be possible., (*26)

The Versions

25/09 2016

dev-master

9999999-dev

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

28/04 2016

v0.1.6

0.1.6.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

14/09 2015

v0.1.5

0.1.5.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

22/07 2015

v0.1.4

0.1.4.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

13/07 2015

v0.1.3

0.1.3.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

30/06 2015

v0.1.2

0.1.2.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

29/06 2015

v0.1.1

0.1.1.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

29/06 2015

v0.1.0

0.1.0.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

10/06 2015

v0.0.9

0.0.9.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

10/06 2015

dev-improve-session-storage

dev-improve-session-storage

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

10/06 2015

v0.0.8

0.0.8.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

06/06 2015

v0.0.7

0.0.7.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

02/06 2015

v0.0.6

0.0.6.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

14/05 2015

v0.0.5

0.0.5.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

29/04 2015

v0.0.4

0.0.4.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

27/04 2015

v0.0.3

0.0.3.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

26/04 2015

v0.0.2

0.0.2.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro

17/04 2015

0.0.1

0.0.1.0

Integrate your Laravel 5 project with Parse (parse.com)

  Sources   Download

MIT

The Requires

 

by Caleb Fidecaro