PHPackages                             duffleman/baelorphp - 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. duffleman/baelorphp

AbandonedArchivedLibrary[API Development](/categories/api)

duffleman/baelorphp
===================

PHP Wrapper for baelor.io API

2.0.0(11y ago)013PHP

Since Apr 14Pushed 11y ago2 watchersCompare

[ Source](https://github.com/BaelorSwift/php-library)[ Packagist](https://packagist.org/packages/duffleman/baelorphp)[ RSS](/packages/duffleman-baelorphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

baelorphp
=========

[](#baelorphp)

php library for [baelor.io](https://baelor.io).

Contents
--------

[](#contents)

- **[Installation](#installation)**
- **[Introduction](#introduction)**
- **[Endpoints](#endpoints)**
    - [Create a user](#create-a-user)
    - [Login as existing user](#login-as-existing-user)
    - [Get an Album](#get-a-single-album)
    - [Get songs from an album](#songs-from-that-album)
    - [Get all songs](#all-songs)
    - [Get a single song](#get-a-single-song)
    - [Lyrics](#lyrics)
    - [Bae](#bae-status)
- **[Examples](#examples)**
    - [Line Length](#find-the-longest-line-in-a-song)
- **[Credits](#credits)**

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

[](#installation)

$ `composer install --no-dev -o`

Introduction
------------

[](#introduction)

baelorphp is a php library for the [baelor.io](https://baelor.io) Taylor Swift API.

*To obtain an API key for baelor.io, run the [Create new API User](#create-a-user) example.*

#### Quick Example

[](#quick-example)

Let's load all of Taylor Swift's albums.

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI('api-key');
$albumCollection = $api->getAlbums();
```

You can also wrap it around try/catch tags to see what (if any) errors are thrown.

Endpoints
---------

[](#endpoints)

Here is what we can do, also see the [baelor.io docs](https://baelor.io/docs) for a full API endpoint list.

### Create a user

[](#create-a-user)

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI();
$user = $api->createUser('myUsername', 'myEmail', 'myPassword');

$ourNewAPIKey = $user->api_key;
```

### Login as existing user

[](#login-as-existing-user)

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI();
$api->login('myUsername', 'myPassword');

$response = $api->getAlbums(); // Returns full set of Albums.
```

### Get a single album

[](#get-a-single-album)

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI('api-key');

$album = $api->getAlbums('1989');
```

### Songs from that Album

[](#songs-from-that-album)

Extending from the above example.

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI('api-key');

$album = $api->getAlbums('1989');

$songs = $album->attributes;
```

### All songs

[](#all-songs)

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI('api-key');

$songCollection = $api->getSongs();
```

### Get a single song

[](#get-a-single-song)

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI('api-key');

$song = $api->getSongs('style');

$length = $song->length; // We can access attributes directly.
```

### Lyrics

[](#lyrics)

Lyrics works slightly differently. But equally as easy.

```
use Duffleman\baelor\BaelorAPI;
use Duffleman\baelor\Results\Lyrics;

$api = new BaelorAPI('api-key');

$song = $api->getSongs('style');

$lyrics = new Lyrics($song, $api);

echo($lyrics->toHTML());
```

### Bae Status

[](#bae-status)

```
use Duffleman\baelor\BaelorAPI;

$api = new BaelorAPI('api-key');

$bae = $api->getBae('word');
// or
$bae = $api->getBae();

var_dump($bae);
```

Examples
--------

[](#examples)

### Find the longest line in a song

[](#find-the-longest-line-in-a-song)

```
use Duffleman\baelor\BaelorAPI;
use Duffleman\baelor\Results\Lyrics;

$api = new BaelorAPI('api-key');

$song = $api->getSongs('style');
$lyrics = new Lyrics($song, $api);

$lines = $lyrics->toArray(true); // true because we do want to strip empty lines.

$longestLength = 0;
$longestLine = '';
foreach($lines as $line) {
  $lineLength = strlen($line);
  if($lineLength > $longestLength) {
    $longestLength = $lineLength;
    $longestLine = $line;
  }
}

echo("The longest line is {$lineLength} characters long. It reads: {$longestLine}.");
```

Credits
-------

[](#credits)

[Baelor API](http://baelor.io) created by [Alex Forbes-Reed](https://github.com/0xdeafcafe) [@0xdeafcafe](http://twitter.com/0xdeafcafe)

[baelorjs libary](https://www.npmjs.com/package/baelorjs) created by [Jamie Davies](https://github.com/viralpickaxe) [@viralpickaxe](http://twitter.com/viralpickaxe)

[baelorphp libary](https://packagist.org/packages/duffleman/baelorphp) created by [George Miller](https://github.com/duffleman) [@duffleman](http://twitter.com/duffleman)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

3

Last Release

4050d ago

Major Versions

1.0.1 → 2.0.02015-04-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/45f4521df25fa81f638ba15f7df5e894056fa902cf9d9664d6b0d82801374a2a?d=identicon)[DuffleOne](/maintainers/DuffleOne)

---

Top Contributors

[![0xdeafcafe](https://avatars.githubusercontent.com/u/2768524?v=4)](https://github.com/0xdeafcafe "0xdeafcafe (3 commits)")

---

Tags

swiftbaelor

### Embed Badge

![Health badge](/badges/duffleman-baelorphp/health.svg)

```
[![Health](https://phpackages.com/badges/duffleman-baelorphp/health.svg)](https://phpackages.com/packages/duffleman-baelorphp)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

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