Skip to content

markheramis/laravel-restful-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Security Rating Maintainability Rating Bugs Vulnerabilities FOSSA Status

About Laravel Restful API

Laravel Restful API is a Restful API project built on top of Laravel that is focused on REST API and Microservices.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed the latest version of PHP and Composer. Here are the commands to install them:

    Install PHP

    sudo apt install php8.2

    Install Composer

    curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer
    sudo chmod +x /usr/local/bin/composer
  • You have installed the necessary PHP extensions for Laravel. Here are the commands to install them:
    • Mbstring PHP Extension: Laravel uses mbstring to handle strings in different character encodings, such as UTF-8.

      sudo apt install php8.2-mbstring
    • XML PHP Extension: Laravel uses XML to parse and generate XML documents, such as configuration files and responses to API requests.

      sudo apt install php8.2-xml
    • ZIP PHP Extension: Composer requires the ZIP extension to efficiently extract archived dependencies.

      sudo apt install php8.2-zip
    • MySQL PHP Extension: This extension is used for connecting to the MySQL database.

      sudo apt install php8.2-mysql
    • Redis PHP Extension: This extension provides APIs for connecting to a Redis server.

      sudo apt install php8.2-redis
    • BCMath Extensions: These extensions are also required by Laravel.

      sudo apt install php8.2-bcmath
  • You have a Windows/Mac/Linux machine. The above commands are for a Linux machine. If you’re using Windows or Mac, the installation commands might be different.
  • Docker installation is optional but recommended for development containerization. If you choose to use Docker, please ensure you have it installed on your machine. You can download it from the official Docker website.

How to Start

The Native Way

Run the following commands

composer install

After execution you must check the .env file and correct your appropriate database settings, NOTE: Make sure the database you set deos exists in your local database system.

php artisan key:generate
php artisan migrate
php artisan db:seed
php artisan telescope:install
php artisan passport:install
php artisan passport:client --personal

Starting it, just run the command

php artisan serve

Testing

Before testing take note that we need to have a .env.testing environment file first, we have an example and to apply it all you need todo is to copy the example file with the following command:

cp .env.testing.example .env.testing

Note that we're not on Docker so you should replace the DB_HOST value in .env.testing with localhost in order for it to work.

To run the local unit test, use the command below

php artisan test

The Docker and Laravel Sail Way

For Docker / Laravel Sail based setup, please refer to this documentation.

Kubernetes with DevSpace

For Kubernetes / DevSpace setup, please refer to this documentation.

WebSocket and Pusher

For extending real-time capabilities, we use websocket and pusher

Specification

For defining this project, we use this specification as a guide in the Development.

TODO

  • Explore Kubernetes Deploy to Production. (Kubernetes/DevSpace)
  • Run composer install after laravel-restful-api pod setup and running. (Kubernetes/DevSpace)

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

License

The Laravel framework is open-sourced software licensed under the MIT license.