Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
/ api Public archive

API layer to support the public website of the Laravel-Portugal community

License

Notifications You must be signed in to change notification settings

laravel-portugal/api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel-Portugal API

Run tests Coverage Status

Installation

Requirements

  • PHP >= 7.4
  • MySQL >= 8, MariaDB >= 10 or PostgreSQL >= 11

Activation

  1. Clone this repository.
  2. Run composer install to install all dependencies (add --no-dev if you're using this in production).
  3. Run cp .env.example .env to create an .env file based on the distributed .env.example file.
  4. Update the .env file with a new APP_KEY and the connection details for the database.
  5. Run php artisan migrate to create the database schema.

Deployment

This project is prepared to be run with Docker. There are docker-compose files that try to provide an easy way to deploy this project to your infrastructure. You should create a docker-compose.override.yml (probably based on the example file provided), and change it to your specific needs.

Documentation

This service API is organized around REST and has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Authentication

Authentication to the API is performed via checking for the presence of a Bearer token on the Authorization header of a request. This token is an encoded JWT that's generated by exchanging the username and the password, of a previously registered user account, on the /login endpoint.

Include relationship data

Many objects allow you to request additional relationship information as an expanded response, by using the include request parameter. This parameter is available on all API requests that have related data available to be included and applies to the response of that request only. You can, however, include multiple objects at once by identifying multiple items in the include query parameter separated by a comma.

Errors

This API uses conventional HTTP response codes to indicate the success or failure of a request. Codes in the 2xx range indicate success, codes in the 4xx range indicate a validation error (e.g., a required parameter was omitted) and codes in the 5xx range indicate an error with the service internal programming (these should be very rare). Check the table below for a list of possible status codes and their meaning:

Code Status Description
200 OK Everything worked as expected.
401 Unauthorized No valid authorization header value provided.
403 Forbidden The supplied authorization key doesn't have permission to perform the request.
404 Not Found The requested resource doesn't exist.
422 Unprocessable Entity The request was unacceptable, often due to missing a required parameter.
429 Too Many Requests Too many requests hit the API too quickly.
5xx Server Errors Something went wrong on the internal service programming.

Support

If you have any problems and need assistance, feel free to use the issue tracker to ask for support. However, be patient! Your request might take time to be answered.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Testing

This project is fully tested. We have an automatic pipeline and an automatic code quality analysis tool set up to continuously test and assert the quality of all code published in this repository, but you can execute the test suite yourself by running the following command:

vendor/bin/phpunit

Note: This assumes you've run composer install (without the --no-dev option).

We aim to keep the master branch always deployable. Exceptions may happen, but they should be extremely rare.

Security

Please see SECURITY for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

API layer to support the public website of the Laravel-Portugal community

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages