/fibonacci

Calculates the Fibonacci number.

Primary LanguagePHPMIT LicenseMIT

Fibonacci Number Calculator

This package calculates the Fibonacci number.

Requirements

  • PHP 7.4 or higher.

Installation

The package could be installed with composer:

composer require roslov/fibonacci

General usage

#!/usr/bin/env php
<?php

declare(strict_types=1);

use Roslov\Fibonacci\Fibonacci;

require_once __DIR__ . '/vendor/autoload.php';

$fibonacciNumber = Fibonacci::calculate(10);

echo $fibonacciNumber;

This will return:

55

Testing

Unit testing

The package is tested with PHPUnit. To run tests:

./vendor/bin/phpunit

Code style analysis

The code style is analyzed with PHP_CodeSniffer and PSR-12 Ext coding standard. To run code style analysis:

./vendor/bin/phpcs --extensions=php --colors --standard=PSR12Ext --ignore=vendor/* -p -s .