Git Product home page Git Product logo

cakeapns's Introduction

Welcome to CakeApns a CakePHP Plugin

CakeApns aimed to be a full wrapper of ApnsPHP for CakePHP.

Features

  • A CakePHP component for pushing messages to APNS
  • Feedback Service wrapper (TODO)
  • Wrapper for ApnsPHP server (TODO)

Installation

Make sure you properly baked your app:

cake bake myapp

and provide the following parameters for your myapp, database setup and some other stuffs.

Clone the plugin inside your myapp/Plugin directory and update the submodules:

git clone http://[your_username]@202.172.229.26/rhodecode/CakeApns
cd CakeApns
git submodule init
git submodule update

Activate the plugin, in your myapp/Config/bootstrap.php add this:

CakePlugin::loadAll(array(
    'CakeApns'
));

Configure you APNS certificates in your myapp/Config/core.php:

Configure::write('CakeApns', array(
    'mode' => 'sandbox',
    'sandbox' => array(
        'combined_certificates' => APP . 'Certificates' . DS . 'combined.pem',
        'cert_passphrase' => 'lightning@sg'
    ),
    'production' => array(
        'combined_certificates' => APP . 'Certificates' . DS . 'combined.pem',
        'cert_passphrase' => 'lightning@sg'
    )
));

Usage

Add CakeApns as component in your controller and send a message:

public $components = array(
    'CakeApns.Apns',
);

public function index() {
    $this->Apns->push('device token', 'message')
}

By default logging were disabled if you want to see the logs returned by APNS:

public $components = array(
    'CakeApns.Apns' => array('logEnabled' => true),
);

Adding custom properties and custom sound:

$options = array('custom_properties' => array('my_property'=>'my_value'));
$sound = 'my_custom_sound.aiff';

$this->Apns->push('device token', 'message', $options, $sound);

Sending messages in one push:

$this->Apns->add('device token', 'message', $options, $sound);
$this->Apns->add('antoher device token', 'message', $options, $sound);
...
$this->Apns->pushMany();

License

CakeApns is released under the WTFPL license.

Support

Send me a bottle of beer or FORK it! :)

cakeapns's People

Contributors

pyodor avatar shoaibmerchant avatar

Watchers

 avatar  avatar

cakeapns's Issues

Make it composer installable

Currently the installation of this plugin is through git submodule, would be nice if it can be installed through composer.

Cleanup or re-work documentation

Obviously there were remnants of informations from my previous company where I created and uses this plugin, it was stored in a private repo before it was open-sourced. It needs to be removed and re-work it perhaps.

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.