PHPackages                             ronappleton/quote-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. ronappleton/quote-api

ActiveProject[API Development](/categories/api)

ronappleton/quote-api
=====================

Quote API

01PHP

Since Jan 21Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Avrillo Conveyancing Technical Test
===================================

[](#avrillo-conveyancing-technical-test)

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

[](#introduction)

This repository contains the code for the Avrillo Conveyancing Technical Test. The test is to create a simple quote API that returns Kanye West quotes utilising the [Kanye Rest API](https://kanye.rest/).

Installation and Setup
----------------------

[](#installation-and-setup)

To install the project please run the following commands in a directory of your choice:

```
composer create-project --stability=dev ronappleton/quote-api quote-api

cd quote-api

vendor/bin/sail up -d
```

Once sail has finished building the containers, run the following command to migrate the database:

```
vendor/bin/sail artisan migrate
```

Once the database has been migrated, run the following command to populate the database with quotes:

```
vendor/bin/sail artisan quotes:cache
```

You may then access the API at [http://localhost/api/quotes?api\_token=1234567890](http://localhost/api/quotes?api_token=1234567890)

The API token is set in the .env file and is set to 1234567890 by default. You can also set the API token in the .env file to any value of your choice.

Testing
-------

[](#testing)

In order to run the tests, run the following command after building the containers:

```
vendor/bin/sail artisan test
```

Methodology
-----------

[](#methodology)

### kanye.rest API

[](#kanyerest-api)

On investigation of the kanye.rest API, it was found that the API returns a single quote in a JSON format. The API is a simple GET request to the endpoint . The API returns a single quote in the following format:

```
{
    "quote": "I feel like I'm too busy writing history to read it."
}
```

The requirements of the test is to create a simple quote API that returns Kanye West quotes. The API should return 5 random quotes, and should be refresh-able to return 5 more random quotes.

This poses an initial problem as the kanye.rest service only returns a single quote per request.

To account for this problem I will create a command that may be ran initially on application setup to populate a database with quotes from the kanye.rest API. This will allow the API to return 5 random quotes The command would also be able to be scheduled to run at a set interval to keep the database up to date with new quotes.

The API must be able to refresh the returned 5 random quotes, this is simply the function of the endpoint for getting quotes so will be considered the refresh function.

The use of cache is allowed in this test, so I will utilise the cache to store the quotes returned from the database to allow for faster retrieval of the quotes.

### Authentication

[](#authentication)

The test requires that the API is secured with authentication without using a package.

The API will be secured with a simple API token.

For this I will add an API\_TOKEN to the env file and use in the auth config file.

A Middleware will be used to check the API token on each request to the API. The Middleware will check the token against the config and allow the request to continue if the token is valid. Otherwise the request will be rejected with a 401 response.

### API Client

[](#api-client)

The test details that the use of Laravel's Manager Pattern is a plus, so I will utilise this pattern when creating the API Client. This will allow extensibility of the API Client to allow for the use of other API's in the future.

### Testing

[](#testing-1)

The test details the usage of feature tests, so I will create feature tests for the API endpoint. The test details that unit tests are a nice to have, so I will create unit tests for the API Client and Manager Pattern and extend the endpoint test to test the authentication middleware.

I will commence the build by writing those tests first, and then writing the code to pass the tests.

Notes
-----

[](#notes)

I have added strict type declarations to files that I have touched and used type hinting where possible, along with return type declarations. I have also added doc blocks to functions and classes where I have felt it necessary.

###  Health Score

12

—

LowBetter than 0% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e2afdd94a6f21a4ec2c5df569b80c1d47d6f5d0428f866f55c4bc117856b58b?d=identicon)[Ron Appleton](/maintainers/Ron%20Appleton)

---

Top Contributors

[![ronappleton](https://avatars.githubusercontent.com/u/3792420?v=4)](https://github.com/ronappleton "ronappleton (14 commits)")

### Embed Badge

![Health badge](/badges/ronappleton-quote-api/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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