Skip to content

Latest commit

 

History

History
104 lines (79 loc) · 4.08 KB

CONTRIBUTING.md

File metadata and controls

104 lines (79 loc) · 4.08 KB

Contributing to php-sparkpost

Transparency is one of our core values, and we encourage developers to contribute and become part of the SparkPost developer community.

The following is a set of guidelines for contributing to php-sparkpost, which is hosted in the SparkPost Organization on GitHub. These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request.

Submitting Issues

  • You can create an issue here, but before doing that please read the notes below on debugging and submitting issues, and include as many details as possible with your report.
  • Include the version of php-sparkpost you are using.
  • Perform a cursory search to see if a similar issue has already been submitted.

Development

Setup (Getting the Tools)

Install Composer

curl -sS https://getcomposer.org/installer | php

Add composer install directory to $PATH ~/.composer/vendor/bin/

phpenv

phpenv is useful for testing locally across different PHP versions.

Developing your app against a local version of the SparkPost library

If you're working on the library and your app together, you can tell Composer to get php-sparkpost from a local path. With a directory structure such as:

home

  • php-sparkpost
  • my-app
    • composer.json
    • .. etc

Use the following for my-app/composer.json:

{
    "name": "sparkpost/php_simple_email_send",
    "description": "a small test program to send an email",
    "repositories": [
        {
            "type": "path",
            "url": "../php-sparkpost"
        }
    ],
    "require": {
        "php-http/guzzle6-adapter": "^1.1",
        "guzzlehttp/guzzle": "^6.0",
        "sparkpost/sparkpost": "dev-master"
    }
}

Memory

We recommend increasing PHP’s memory limit, by default it uses 128MB. We ran into some issues during local development without doing so. You can do this by editing your php.ini file and modifying memory_limit. We set ours to memory_limit = 1024M.

Install XDebug for code coverage generation

Follow the instructions at xdebug.org

Development Tool Resources

Local Development

Contribution Steps

Guidelines

  • Provide documentation for any newly added code.
  • Provide tests for any newly added code.
  • Follow PSR-2 (will be auto-enforced by php-cs-fixer in a later step)
  1. Create a new branch named after the issue you’ll be fixing (include the issue number as the branch name, example: Issue in GH is #8 then the branch name should be ISSUE-8)
  2. Write corresponding tests and code (only what is needed to satisfy the issue and tests please)
    • Include your tests in the 'test' directory in an appropriate test file
    • Write code to satisfy the tests
  3. Ensure automated tests pass
  4. Run composer run-script fix-style to enforce PSR-2 style
  5. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.

Testing

Once you are setup for local development:

  • You can execute the unit tests using: composer test
  • You can view coverage information by viewing: open test/output/report/index.html

Releasing

  • Update version in the library during development. This is used in the user_agent of your requests.

  • Once it's been merged down, create a release tag in git.

  • Composer will automatically pickup the new tag and present it as a release.