php[architect] November 2018

(singke) #1
http://www.phparch.com \ November 2018 \ 35

Producing Packages, Part Two


The Workshop


the project by submitting pull requests
will go a long way to making your proj-
ect successful.
Since we’re hosting our library on
GitHub, we want to use Github Issues
to track any problems users may be
having. While we do want to support
pull requests and users contributing we
should be up front about our PHP Easy
Math library is for learning purposes
so we may not merge all pull requests.
These instructions are shown in Listing
8.
Now our README.md file is complete
with information about what our library
does, the build state, how to install, how


to use it, how to contribute features or
fixes, and where to get help.

Recap
This month we added a chunk of
information to our README.md file to
inform our potential users about our
build status, installation instructions,

usage, and how to contribute. Now
that our library is ready for real world
usage what happens when we get a
pull request? What if we need to add
features? Next month we’re going to
dive into how to triage issues, pull
requests, adding features as well as
tagging new releases!

Joe Ferguson is a PHP developer and community organizer.
He is involved with many different technology related initia-
tives in Memphis including the Memphis PHP User group. He’s
been married to his extremely supportive and amazing wife
for a really long time and she turned him into a crazy cat man.
They live in the Memphis suburbs with their two cats.
@JoePFerguson

Listing 5



  1. PHP Easy Math





  2. ![Build Status^[![Build Status: https://travis-ci.org/svpernova09/php-easy-math.svg?branch=master]]

  3. (https://travis-ci.org/svpernova09/php-easy-math)




  4. A simple library to do math for you





  5. PHP Easy Math provides two classes containing two methods each. The Addition

  6. class provides the add() method which takes two parameters and returns the

  7. sum. The Addition class also contains the sum() method which will take any

  8. number of floats and return the sum. The Subtraction class provides a single

  9. subtract() class taking two parameters and will return the difference of the

  10. supplied parameters.


Listing 6



  1. Installation





  2. Using Composer^[Composer: https://getcomposer.org/]:








  3. composer require svpernova/php-easy-math







  4. Usage





  5. See example.php^[example.php: <example.php>]


Listing 7


  1. <?php



  2. use EasyMath\Addition;

  3. use EasyMath\Subtraction;



  4. require DIR. '/vendor/autoload.php';



  5. $add = new Addition();

  6. echo $add->add( 3 , 2 ). PHP_EOL;



  7. $sub = new Subtraction();

  8. echo $sub->subtract( 3 , 2 ). PHP_EOL;


Listing 8



  1. Getting Help





  2. Please open a new Github issue^[Github issue: https://github.com/svpernova09/php-easy-math/issues/new]



  3. detailing your problem.




  4. Contributing





  5. Pull requests welcome, however since this library was built for demonstration

  6. purposes only pull requests may not be merged in an effort to keep the library

  7. basic and easy to understand.

Free download pdf