Download the PHP package danabrey/mfl-api without Composer

On this page you can find all versions of the php package danabrey/mfl-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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

composer require danabrey/mfl-api

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

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

It is your responsibility to abide by the terms of the MFL API.

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

./vendor/bin/phpunit

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. 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

Read more about Treeware at treeware.earth


All versions of mfl-api with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
symfony/serializer Version ^5.1|^6.0|^7.0
symfony/http-client Version ^5.1|^6.0|^7.0
symfony/property-access Version ^5.1|^6.0|^7.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package danabrey/mfl-api contains the following files

Loading the files please wait ....