Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Dec 20, 2015
2 parents ea475db + 9f0fd4b commit 81f27a2
Show file tree
Hide file tree
Showing 128 changed files with 879 additions and 2,025 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
@@ -1,6 +1,6 @@
app/cache/*
app/logs/*
build/
composer.lock
composer.phar
var/cache/*
var/logs/*
vendor/
27 changes: 22 additions & 5 deletions .php-cs-fixer.php
@@ -1,14 +1,31 @@
<?php

return Symfony\CS\Config\Config::create()->finder(Symfony\CS\Finder\DefaultFinder::create()
->exclude('app/cache')
->exclude('app/log')
$fixers = [
'-no_empty_lines_after_phpdocs',
'-psr0',
'ordered_use',
'php_unit_construct',
'php_unit_strict',
'phpdoc_order',
'short_array_syntax',
];

$finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude('build')
->exclude('var/cache')
->exclude('var/log')
->exclude('vendor')
->ignoreDotFiles(false)
->ignoreVCS(true)
->in(__DIR__)
->notName('*.phar')
->notName('LICENSE')
->notName('README.md')
->notName('composer.*')
->notName('phpunit.xml*')
);
->notName('phpunit.xml*');

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->setUsingCache(false)
->fixers($fixers)
->finder($finder);
12 changes: 6 additions & 6 deletions .sami.php
Expand Up @@ -13,14 +13,14 @@
$versions = GitVersionCollection::create($dir)
->add('develop', 'develop branch')
->add('master', 'master branch')
->addFromTags('*');
->addFromTags('1.*');

return new Sami($iterator, array(
'theme' => 'enhanced',
return new Sami($iterator, [
'theme' => 'default',
'versions' => $versions,
'title' => 'AuthBucket\Push API',
'build_dir' => __DIR__ . '/build/sami/%version%',
'cache_dir' => __DIR__ . '/build/cache/sami/%version%',
'build_dir' => __DIR__.'/build/sami/%version%',
'cache_dir' => __DIR__.'/build/cache/sami/%version%',
'include_parent_data' => false,
'default_opened_level' => 2,
));
]);
38 changes: 29 additions & 9 deletions .travis.yml
@@ -1,21 +1,41 @@
---

sudo: false

dist: trusty

language: php

php:
- 5.3
- 5.4
- 5.5
- hhvm
before_install:
- composer self-update
- composer global require satooshi/php-coveralls:@stable
- export PATH="$PATH:$HOME/.composer/vendor/bin"

install:
- sh -c "if [ '$TWIG_VERSION' = '1.8' ]; then sed -i 's/~1.8|~2.0/~1.8/g' composer.json; composer update; fi"
- sh -c "if [ '$SYMFONY_DEPS_VERSION' = '2.8' ]; then sed -i 's/~2.8|~3.0/~2.8/g' composer.json; composer update; fi"
- composer install --prefer-source

before_script:
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- composer install --dev --prefer-source
- mkdir -p build/logs
- rm -rf app/cache/*/*

script:
- vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover ./build/logs/clover.xml
- composer phpunit

after_script:
- php vendor/bin/coveralls -v
- composer coveralls

matrix:
include:
- php: 5.5
- php: 5.6
- php: 5.6
env: TWIG_VERSION=1.8
- php: 5.6
env: SYMFONY_DEPS_VERSION=2.8
- php: 7.0
- php: hhvm
allow_failures:
- php: 7.0
- php: hhvm
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Wong Hoi Sing Edison
Copyright (c) 2015 Wong Hoi Sing Edison

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
112 changes: 60 additions & 52 deletions README.md
@@ -1,85 +1,95 @@
AuthBucket\\Push
================

[![Build
Status](https://travis-ci.org/authbucket/push-php.svg?branch=master)](https://travis-ci.org/authbucket/push-php)
[![Coverage
Status](https://img.shields.io/coveralls/authbucket/push-php.svg)](https://coveralls.io/r/authbucket/push-php?branch=master)
[![Dependency
Status](https://www.versioneye.com/php/authbucket:push-php/dev-master/badge.svg)](https://www.versioneye.com/php/authbucket:push-php/dev-master)
[![Latest Stable
Version](https://poser.pugx.org/authbucket/push-php/v/stable.svg)](https://packagist.org/packages/authbucket/push-php)
[![Total
Downloads](https://poser.pugx.org/authbucket/push-php/downloads.svg)](https://packagist.org/packages/authbucket/push-php)
[![Build Status](https://travis-ci.org/authbucket/push-php.svg?branch=master)](https://travis-ci.org/authbucket/push-php)
[![Coverage Status](https://coveralls.io/repos/authbucket/push-php/badge.svg?branch=master&service=github)](https://coveralls.io/github/authbucket/push-php?branch=master)
[![Dependency Status](https://www.versioneye.com/php/authbucket:push-php/dev-master/badge.svg)](https://www.versioneye.com/php/authbucket:push-php/dev-master)
[![Latest Stable Version](https://poser.pugx.org/authbucket/push-php/v/stable.svg)](https://packagist.org/packages/authbucket/push-php)
[![Total Downloads](https://poser.pugx.org/authbucket/push-php/downloads.svg)](https://packagist.org/packages/authbucket/push-php)
[![License](https://poser.pugx.org/authbucket/push-php/license.svg)](https://packagist.org/packages/authbucket/push-php)

The primary goal of [AuthBucket\\Push](http://push-php.authbucket.com/)
is to develop a library for sending out push notifications to mobile
devices; secondary goal would be develop corresponding wrapper [Symfony2
Bundle](http://symfony.com) and [Drupal module](https://www.drupal.org).
The primary goal of [AuthBucket\\Push](http://push-php.authbucket.com/) is to develop a library for sending out push notifications to mobile devices; secondary goal would be develop corresponding wrapper [Symfony2 Bundle](http://symfony.com) and [Drupal module](https://www.drupal.org).

This library bundle with a [Silex](http://silex.sensiolabs.org/) based
[AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/AuthBucket/Push/Provider/AuthBucketPushServiceProvider.php)
for unit test and demo purpose. Installation and usage can refer as
below.
This library bundle with a [Silex](http://silex.sensiolabs.org/) based [AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/Provider/AuthBucketPushServiceProvider.php) for unit test and demo purpose. Installation and usage can refer as below.

Installation
------------

Simply add a dependency on `authbucket/push-php` to your project's `composer.json` file if you use [Composer](http://getcomposer.org/) to manage the dependencies of your project.

Here is a minimal example of a `composer.json`:

{
"require": {
"authbucket/push-php": "~3.0"
}
}

### Parameters

The bundled [AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/Provider/AuthBucketPushServiceProvider.php) come with following parameters:

- `authbucket_push.model`: (Optional) Override this with your own model classes, default with in-memory AccessToken for using resource firewall with remote debug endpoint.
- `authbucket_push.model_manager.factory`: (Optional) Override this with your backend model managers, e.g. Doctrine ORM EntityRepository, default with in-memory implementation for using resource firewall with remote debug endpoint.

### Services

The bundled [AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/Provider/AuthBucketPushServiceProvider.php) come with following services controller which simplify the Push controller implementation overhead:

- `authbucket_push.push_controller`: Push endpoint controller.

### Registering

If you are using [Silex](http://silex.sensiolabs.org/), register [AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/Provider/AuthBucketPushServiceProvider.php) as below:

$app->register(new AuthBucket\Push\Provider\AuthBucketPushServiceProvider());

Moreover, enable following service providers if that's not already the case:

$app->register(new AuthBucket\OAuth2\Provider\AuthBucketOAuth2ServiceProvider());
$app->register(new Silex\Provider\MonologServiceProvider());
$app->register(new Silex\Provider\SecurityServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());

Demo
----

The demo is based on [Silex](http://silex.sensiolabs.org/) and
[AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/AuthBucket/Push/Provider/AuthBucketPushServiceProvider.php).
Read though [Demo](http://push-php.authbucket.com/demo) for more
information.
The demo is based on [Silex](http://silex.sensiolabs.org/) and [AuthBucketPushServiceProvider](https://github.com/authbucket/push-php/blob/master/src/Provider/AuthBucketPushServiceProvider.php). Read though [Demo](http://push-php.authbucket.com/demo) for more information.

You may also run the demo locally. Open a console and execute the
following command to install the latest version in the `push-php`
directory:
You may also run the demo locally. Open a console and execute the following command to install the latest version in the `push-php` directory:

$ composer create-project authbucket/push-php push-php "~0.0"
$ composer create-project authbucket/push-php authbucket/push-php "~1.0"

Then use the PHP built-in web server to run the demo application:

$ cd push-php
$ php app/console server:run
$ cd authbucket/push-php
$ ./app/console server:run

If you get the error
`There are no commands defined in the "server" namespace.`, then you are
probably using PHP 5.3. That's ok! But the built-in web server is only
available for PHP 5.4.0 or higher. If you have an older version of PHP
or if you prefer a traditional web server such as Apache or Nginx, read
the [Configuring a web
server](http://silex.sensiolabs.org/doc/web_servers.html) article.
If you get the error `There are no commands defined in the "server" namespace.`, then you are probably using PHP 5.3. That's ok! But the built-in web server is only available for PHP 5.4.0 or higher. If you have an older version of PHP or if you prefer a traditional web server such as Apache or Nginx, read the [Configuring a web server](http://silex.sensiolabs.org/doc/web_servers.html) article.

Open your browser and access the <http://127.0.0.1:8000> URL to see the
Welcome page of demo application.
Open your browser and access the <http://127.0.0.1:8000> URL to see the Welcome page of demo application.

Also access <http://127.0.0.1:8000/admin/refresh_database> to initialize
the bundled SQLite database with user account `admin`:`secrete`.
Also access <http://127.0.0.1:8000/admin/refresh_database> to initialize the bundled SQLite database with user account `admin`:`secrete`.

Documentation
-------------

Push's documentation is built with
[Sami](https://github.com/fabpot/Sami) and publicly hosted on [GitHub
Pages](http://authbucket.github.io/push-php).
Push's documentation is built with [Sami](https://github.com/fabpot/Sami) and publicly hosted on [GitHub Pages](http://authbucket.github.io/push-php).

To built the documents locally, execute the following command:

$ vendor/bin/sami.php update .sami.php
$ composer sami

Open `build/sami/index.html` with your browser for the documents.

Tests
-----

This project is coverage with [PHPUnit](http://phpunit.de/) test cases;
CI result can be found from [Travis
CI](https://travis-ci.org/authbucket/push-php); code coverage report can
be found from [Coveralls](https://coveralls.io/r/authbucket/push-php).
This project is coverage with [PHPUnit](http://phpunit.de/) test cases; CI result can be found from [Travis CI](https://travis-ci.org/authbucket/push-php); code coverage report can be found from [Coveralls](https://coveralls.io/r/authbucket/push-php).

To run the test suite locally, execute the following command:

$ vendor/bin/phpunit
$ composer phpunit

Open `build/logs/html` with your browser for the coverage report.

Expand All @@ -96,7 +106,5 @@ References
License
-------

- Code released under
[MIT](https://github.com/authbucket/push-php/blob/master/LICENSE)
- Docs released under [CC BY-NC-SA
3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/)
- Code released under [MIT](https://github.com/authbucket/push-php/blob/master/LICENSE)
- Docs released under [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/)
7 changes: 7 additions & 0 deletions app/.htaccess
@@ -0,0 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
19 changes: 12 additions & 7 deletions app/AppKernel.php
Expand Up @@ -11,22 +11,27 @@

use Symfony\Component\HttpFoundation\Request;

# Register MUST have Silex providers for AuthBucketOAuth2ServiceProvider.
$app->register(new AuthBucket\OAuth2\Provider\AuthBucketOAuth2ServiceProvider());
$app->register(new AuthBucket\Push\Tests\TestBundle\TestBundleServiceProvider());
$app->register(new Silex\Provider\MonologServiceProvider());
$app->register(new Silex\Provider\SecurityServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());

# Register AuthBucketPushServiceProvider.
$app->register(new AuthBucket\Push\Provider\AuthBucketPushServiceProvider());

# Register additional Silex providers for TestBundleServiceProvider.
$app->register(new Silex\Provider\DoctrineServiceProvider());
$app->register(new Silex\Provider\FormServiceProvider());
$app->register(new Silex\Provider\SecurityServiceProvider());
$app->register(new Silex\Provider\SerializerServiceProvider());
$app->register(new Silex\Provider\RememberMeServiceProvider());
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\SessionServiceProvider());
$app->register(new Silex\Provider\TranslationServiceProvider());
$app->register(new Silex\Provider\TwigServiceProvider());
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());

$provider = new AuthBucket\Push\Provider\AuthBucketPushServiceProvider();
$app->register($provider);
$app->mount('/', $provider);
# Register TestBundleServiceProvider.
$app->register(new AuthBucket\Push\Tests\TestBundle\TestBundleServiceProvider());

require __DIR__.'/config/config_'.$app['env'].'.php';

Expand Down
13 changes: 13 additions & 0 deletions app/autoload.php
@@ -0,0 +1,13 @@
<?php

use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;

/*
* @var ClassLoader
*/
$loader = require __DIR__.'/../vendor/autoload.php';

AnnotationRegistry::registerLoader([$loader, 'loadClass']);

return $loader;
51 changes: 0 additions & 51 deletions app/bootstrap.php

This file was deleted.

Empty file removed app/cache/dev/.empty
Empty file.
Empty file removed app/cache/prod/.empty
Empty file.
Empty file removed app/cache/test/.empty
Empty file.

0 comments on commit 81f27a2

Please sign in to comment.