Giter Site home page Giter Site logo

zoiodev / cakephp-parse-datasource Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pollenizer/cakephp-parse-datasource

0.0 1.0 0.0 95 KB

A CakePHP DataSource for interfacing with the Parse REST API

Home Page: http://pollenizer.com/

PHP 100.00%

cakephp-parse-datasource's Introduction

CakePHP Parse Datasource
Allows interfacing between the Parse REST API

https://www.parse.com
https://www.parse.com/docs/rest
http://book.cakephp.org/2.0/en/core-utility-libraries/httpsocket.html

INSTALLATION
-------------
Copy ParseSource.php into the app/Model/Datasource directory.

CONFIGURATION
-------------
Within database.php add:

    public $parse = array(
        'datasource' => 'ParseSource',
        'application_id' => 'xxxxxxxxx',
        'rest_api_key' => 'xxxxxxxx',
    );

Create a model such as 'Parse.php' & add:

    public $useDbConfig = 'parse';
    public $useTable = false;

USAGE
-------------
Initially it would be good to get your head around what's required per call according to : https://www.parse.com/docs/rest

From here you can use the Datasource in the following way:
    //Send a push notification
    $data = array(
        'body' => array(
            'channel' => '1234', //user to push to?
            'type' => 'ios', //ios/android
            'data' => array(
            //This data is an example
                'alert' => 'Hey this is a push notification.',
                'type' => 'notification',
                'sound' => '1',
            )
        ));
    $response = $this->push($data);
    //$response == false ?
    $response = $this->getError();
Note : The datasource json encodes the data field, there is no need to do so. 

//Making a different call
    $data = array(
        'method' => 'GET',
    );
    $this->removeHeader('Content-Type'); //This call doesn't require this header
    // We can also use $this->setHeader(array('Content-Type' => 'application/json')); if an additional header is required
    $response = $this->users($data);
    //The same thing applies, if $response is false we can call $this->getError();

cakephp-parse-datasource's People

Contributors

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