PHPackages                             danabrey/mfl-api - 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. [API Development](/categories/api)
4. /
5. danabrey/mfl-api

ActiveLibrary[API Development](/categories/api)

danabrey/mfl-api
================

PHP library for interacting with the MyFantasyLeague.com API

v2.0(5mo ago)31.1k1MITPHPPHP ^7.4|^8.0CI failing

Since Jun 29Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/danabrey/mfl-api)[ Packagist](https://packagist.org/packages/danabrey/mfl-api)[ RSS](/packages/danabrey-mfl-api/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (31)Used By (0)

MFL API
=======

[](#mfl-api)

This is a PHP library for interacting with the MyFantasyLeague.com API. It's a work in progress, and I am actively developing it for use in other projects.

Installation
------------

[](#installation)

`composer require danabrey/mfl-api`

Usage
-----

[](#usage)

Create an instance of the client

`$client = new DanAbrey\MFLApi\MFLApiClient(2020);`

The league year is required. You can optionally pass an API key as the second argument for sending in all requests:

`$client = new DanAbrey\MFLApi\MFLApiClient(2020, 'my_api_key');`

Use the client methods to make requests to the API, e.g.:

`$client->players()`

`$client->league('XXXXX')` where XXXXX is the league ID.

`$client->rosters('XXXXX')` where XXXXX is the league ID.

All methods return either a single instance or an array of plain PHP objects that represent the data returned. e.g. `MFLPlayer`, `MFLRoster[]`, etc.

### Exception handling

[](#exception-handling)

The library throws a number of exceptions for you to decide how to handle yourself. They all extend the abstract `DanAbrey\MFLApi\Exceptions\MFLApiException` class.

**UnauthorizedException**: the API responded telling you that the endpoint needs an API key to access that data

**InvalidParametersException**: the API responded with an error hinting that you may have forgotten to pass a required parameter

**UnknownApiError**: the API responded with a 5xx HTTP error, usually this will mean there is an issue with the API at MFL's end

Note
----

[](#note)

It is your responsibility to abide by the [terms of the MFL API](https://www68.myfantasyleague.com/2020/api_info).

Development
-----------

[](#development)

I am actively seeking contributors to this project. The MFL API is a complex and quite large beast, and accessing its data in projects can be a cumbersome task. This project aims to add reliable typing and understandable error handling via custom exceptions.

Please feel free to open an issue if you'd like to get involved.

### Running tests

[](#running-tests)

`./vendor/bin/phpunit`

Treeware
--------

[](#treeware)

This package is MIT licensed and you are free to use it in open or closed source projects. If it makes it to your production environment, I would very much appreciate it if you bought the world some trees.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to [plant trees](https://www.bbc.co.uk/news/science-environment-48870920). If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at [offset.earth/treeware](https://plant.treeware.earth/Astrotomic/php-open-graph)

Read more about Treeware at [treeware.earth](https://treeware.earth)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance71

Regular maintenance activity

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~358 days

Total

29

Last Release

163d ago

Major Versions

v1.11 → v2.02026-01-22

PHP version history (2 changes)v1.0PHP ^7.4

v1.5PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10567440?v=4)[Dan Abrey](/maintainers/danabrey)[@danabrey](https://github.com/danabrey)

---

Top Contributors

[![danabrey](https://avatars.githubusercontent.com/u/10567440?v=4)](https://github.com/danabrey "danabrey (20 commits)")[![fakingfantastic](https://avatars.githubusercontent.com/u/20476?v=4)](https://github.com/fakingfantastic "fakingfantastic (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/danabrey-mfl-api/health.svg)

```
[![Health](https://phpackages.com/badges/danabrey-mfl-api/health.svg)](https://phpackages.com/packages/danabrey-mfl-api)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M572](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
