Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 3.69 KB

CONTRIBUTING.md

File metadata and controls

31 lines (20 loc) · 3.69 KB

Contributing to PHPWord

PHPWord is built by the crowd and for the crowd. Every contribution is welcome; either by reporting a bug or suggesting improvements, or in a more active form like requesting a pull.

We want to create a high quality document writer and reader library that people can use with more confidence and fewer bugs. We want to collaborate happily, code joyfully, and live merrily. Thus, below are some guidelines that we expect to be followed by each contributor:

  • Be brief, but be bold. State your issues briefly. But speak out your ideas loudly, even if you can't or don't know how to implement them right away. The world will be better with limitless innovations.
  • Follow PHP-FIG standards. We follow PHP Standards Recommendations (PSRs) by PHP Framework Interoperability Group. If you're not familiar with these standards, familiarize yourself now. Also, please run composer fix to automatically fix your code to match these recommendations.
  • Test your code. No one knows your code better than you, so we depend on you to test the changes you make before pull request submission. We use PHPUnit for our testing purposes and request that you use this tool too. Tests can be ran with composer test. Documentation for writing tests with PHPUnit is available on Read the Docs.
  • Use best practices when submitting pull requests. Create a separate branch named specifically for the issue that you are addressing. Read the GitHub manual to learn more about pull requests and GitHub. If you are new to GitHub, read this short manual to get yourself familiar with forks and how git works in general. This video explains how to synchronize your fork on GitHub with the upstream branch from PHPWord.

Getting Started

  1. Clone PHPWord
  2. Install Composer if you don't already have it
  3. Open your terminal and:
  4. Switch to the directory PHPWord was cloned to (e.g., cd ~/Projects/PHPWord/)
  5. Run composer install to install the dependencies

You're ready to start working on PHPWord! Tests belong in the /tests/PhpWord/ directory, the source code is in /src/PhpWord/, and any documentation should go in /docs/. Familiarize yourself with the codebase and try your hand at fixing one of our outstanding issues. Before you get started, check the existing pull requests to make sure no one else is already working on it.

Once you have an issue you want to start working on, you'll need to write tests for it, and then you can start implementing the changes necessary to pass the new tests. To run the tests, you can run one of the following commands in your terminal:

  • composer test-no-coverage to run all of the tests
  • composer test to run all of the tests and generate test coverage reports

When you're ready to submit your new (and fully tested) feature, ensure composer check passes and submit a pull request to PHPWord.

That's it. Thank you for your interest in PHPWord, and welcome!

May the Force be with you.