PHPackages                             delboy1978uk/phi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. delboy1978uk/phi

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

delboy1978uk/phi
================

An analogue fractional calculator

v0.1.0(8y ago)115MITPHP

Since Oct 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/delboy1978uk/phi)[ Packagist](https://packagist.org/packages/delboy1978uk/phi)[ RSS](/packages/delboy1978uk-phi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

phi
===

[](#phi)

[![Build Status](https://camo.githubusercontent.com/4b77615abe530512d8adab642c1768b497bee87e51ef666543acfaae9e481056/68747470733a2f2f7472617669732d63692e6f72672f64656c626f7931393738756b2f7068692e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/delboy1978uk/phi) [![Code Coverage](https://camo.githubusercontent.com/ba451fb32181f82f401c9fa204e9010b04f3486175adcbfdada0c374572a9fe5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656c626f7931393738756b2f7068692f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/delboy1978uk/phi/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/d503de933b0d435acd3f004eb49029276e444a6cddd64b31fdf3f1bbb562eef4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656c626f7931393738756b2f7068692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/delboy1978uk/phi/?branch=master)
Floats suck. So lets make an analogue fractional calculator. Join in!

### v0.0.5

[](#v005)

Refactoring fractions (apparently) works! We might need more test cases. Help us add some!

install the project
-------------------

[](#install-the-project)

First fork the project on GitHub. Then,

```
git clone https://github.com/your-github-name/phi
cd phi
composer install

```

run the tests
-------------

[](#run-the-tests)

```
codecept run unit --coverage-html

```

Or you can log into  and hook up your forked repository. Then by git pushing the tests will run.

do your thing
-------------

[](#do-your-thing)

You either build, break, or fix. Get the test passing, or add a new set of data which will make the tests fail.

#### new feature

[](#new-feature)

We have a `setNegative($bool)` method for negative fractions. We haven't added any test cases for that, so why not join in the fun? :-)

#### adding a test case

[](#adding-a-test-case)

In `tests/unit/Phi/PhiTest.php` you can see the `testToString()` test. There is a dataset, each being an array with four values; the whole, the numerator, the denominator, and the expected string output. Contributing can be as simple as throwing some numbers in there and try to break the class!

send your pull request
----------------------

[](#send-your-pull-request)

Because contributing to open source is fun!

usage
-----

[](#usage)

Right now, there is only one class, `Del\Phi\Fraction`. An object representing a fraction, comprising of a whole number, and fractional numerator and denominator.

```
