Skip to content

seanpierce/api.mississippirecords.net

Repository files navigation

api.mississippirecords.net

As hackneyed and precious as it may be interpreted, we actually believe that records can be powerful hoodoo totemistic and utilitarian objects that can further the development of culture, revolution and spirituality. They can be more than just cultural commodities.
– Eric Isaacson, Mississippi Records

This project contains the source code for PHP web API developed using the Lumen framework with the Eloquent ORM. Dependencies are managed using Composer.

Usage

Running this project locally

Download the project

git clone https://github.com/seanpierce/api.mississippirecords.net

Install dependencies

composer update

Create a mysql database and add the connection info to the .env file in the projetc's root

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=8889
DB_DATABASE=lumenapidb
DB_USERNAME=root
DB_PASSWORD=root
php artisan migrate

Seed the database with placeholder data

php artisan db:seed

Serve the project locally via MAMP or WAMP

Move this project to the root of your server's directory

mv api.mississippirecords.net ~/Sites/api.mississippirecords.net

In your browser, navigate to the project via your server's localhost port: http://localhost:8888/api.mississippirecords.net/

Serve the projet locally using php's built-in development server

# from the public directory (default configuration)
php -S localhost:8000 -t public
# from the root directory
php -S localhost:8000

In your browser, navigate to: http://localhost:8000/

Developing new features

Generate a migration for the project's database

# Generate a migration for the project's database
php artisan make:migration create_some_table
# Specify a table to update with the "--table" flag
php artisan make:migration update_some_table --table=some_table

Documentation

Download the latest postman docs/ API request and response data here.

Testing

# Reset the database
php artisan migrate:refresh --seed
# Run the tests
vendor/bin/phpunit
# Run a specific test group
vendor/bin/phpunit --group=some_group_name

TODOs

  • Create and enable CORS midleware
  • Establish Pilot subdomain
  • Deploy API as a proof-of-concept
  • Develop more meaningful unit tests. Reference this article.
  • Create email queue, or employ email queuing service.
  • Implement repository design pattern, creating a data access layer, via this article.

Why keep this repo public?

Besides being a staunch open-source advocate, it's important for me to keep a public-facing document of my progress with new (to me) technologies. It leads me to be more responsible with my development, and write cleaner code. Additionally, I aim to follow the OWASP principal which encourages organizations to "avoid security by obscurity".

About

A web API developed using PHP and the Lumen framework with the Eloquent ORM. Dependencies are managed using Composer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published