php-pushwoosh

A PHP Library to easily send push notifications with the Pushwoosh REST Web Services.

View project onGitHub
Search

How to contribute

Your are welcome to contribute to the project by simply posting issues or by providing pull resquests.

Each time you provide a pull request to fix bugs or propose an evolution you MUST adhere to the conventions and best practices described here.

Always create PRs on the develop branch

The project is hosted on Github using 2 branches :

  • develop : This branch MUST BE used to create Pull Requests
  • master : This branch MUST NEVER BE used directly to create Pull Requests and is maintained by GoMoob

All Pull Requests created using the master branch will be rejected.

Coding conventions

Formatting

The source code MUST BE compliant with the following PSRs :

  • Basic Coding Standard PSR-1
  • Coding Style Guide PSR-2

If you provide a Pull Request with source code which is not compliant with those 2 standards the CI build will fail.

To check if your code is compliant with PSR-1 and PSR-2 a Grunt build command which uses PHP_CodeSniffer is provided with the project, ALWAYS execute it before commiting your changes.

grunt phpcs

Sometimes this command will output a lot of errors, an other Grunt command is provided to automatically fix the most common errors (this command uses the PHP_CodeSniffer phpcbf tool ).

grunt phpcs

Unit tests

The unit tests of the project are executed using PHPUnit, the main code has to be placed inside the src/main/php directory, the test code has to be placed inside the src/test/php directory.

Each class which is tested is named using a clearly defined convention, for example the class Gomoob\Pushwoosh\Model\Request\CreateMessageRequest which is placed in the src/main/php directory is tested using a class named GoMoob\Pushwoosh\Model\Request\CreateMessageRequestTest placed in the src/test/php directory.

A test class MUST have the same PHP namespace as the class it tests.

Build scripts

The build scripts of the project are managed using the Grunt build tool.

To execute the builds first install Grunt (which needs NodeJS) and then pull the Node dependencies / Grunt plugins required by the Gruntfile build script.

$ npm install
npm http GET https://registry.npmjs.org/grunt-contrib-copy
npm http GET https://registry.npmjs.org/grunt-phpunit
...

Then install Composer and executes the following command to pull the PHP dependencies required (in fact this is onlye necessary to generate the vendor/autoload.php file required for the PHP classes autoloading).

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
...

Default build task

The default build task cleans the temporary target directory of the project, executes the unit tests and generates the PHPDocumentor documentation.

grunt

Execute the unit tests

grunt test

Generate the PHPDocumentor documentation

grunt generate-documentation