Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rinaldilucas/laravel-school-api

An api built using Laravel and MySQL.
https://github.com/rinaldilucas/laravel-school-api

laravel mysql php phpunit swagger

Last synced: 6 days ago
JSON representation

An api built using Laravel and MySQL.

Awesome Lists containing this project

README

        

[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]





Logo

Laravel School REST API


Project built using PHP, Laravel, Composer and MySQL
to jump start your studies!


Explore the docs »




View App
·
Donate


Table of Contents



  1. About The Project



  2. Getting Started


  3. Usage

  4. Contributing

  5. License

  6. Contact

  7. Donations

## About The Project

[![Project Screenshot][project-screenshot]](https://rinaldilucas.github.io/laravel-school-api/)

This straightforward project was created using Laravel for educational purposes. If you found this repository helpful, please feel free to show your support by giving it a star or contributing via a pull request!

Here are some of the features:

### Backend

- Built using REST API practices
- Authentication using Sanctum
- Password encryption using bcrypt with salt rounds
- Authentication with brute force prevention using ExpressBrute
- Example of a migration changing columns and handling data on production
- Custom command to run migrations and seeders
- API documentation using Swagger
- Several test examples using PHPUnit
- Package management using composer
- Factories using faker to help tests and seeding
- Example of endpoint receiving http data with custom names
- Data removal using soft delete

(back to top)

### Built With

This section shows what technologies are used in this particular project.

- [PHP](https://www.php.net/)
- [Laravel](https://laravel.com/)
- [Composer](https://getcomposer.org/)
- [MySQL](https://www.mysql.com/)
- [PHPUnit](https://phpunit.de/)
- [Swagger](https://swagger.io/)

(back to top)

## Getting Started

After cloning the project, you need to do a few things to be able to run it.

### Prerequisites

You need to have the following requirements:

- mysql (download here)
- composer (download here)
- php 8.2 (download here)
- apache (download here for Linux)
or
- xampp (download here)

### Installation

_Below is an example of how you can run the project._

_More scripts at package.json_

1. Clone the repo
```sh
git clone https://github.com/rinaldilucas/laravel-school-api.git
```
2. Setup the necessary environment variables
```
https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa
```
3. Install packages via composer
```sh
composer install
```
4. Populate the database
```js
php artisan custom:run
```
5. Run tests
```js
php artisan test
```

(back to top)

## Usage

You can seed the database as shown before or seed the database via `./database/database.sql`. You can also import the Insomnia routes via file `./database/routes-collection.json`.
Below are the implemented routes: you also can view them inside `./routes/api.php` file or through the Swagger documentation at `http://localhost:80/api/documentation/`.

```js
-------------------------------
-------- [AUTH ROUTES] --------
-------------------------------
[POST] localhost:80/api/auth/login -> 'login'
```

```js
-------------------------------
-------- [USER ROUTES] --------
-------------------------------
[GET] localhost:80/api/user -> 'getOne'
```

```js
-------------------------------
------- [SCHOOL ROUTES] -------
-------------------------------
[GET] localhost:80/api/escolas -> 'getAll'
[GET] localhost:80/api/escolas/{id}/alunos -> 'getAllStudentsBySchool'
```

```js
-------------------------------
------ [STUDENT ROUTES] -------
-------------------------------
[POST] localhost:80/api/alunos -> 'create'
[PUT] localhost:80/api/alunos/{id} -> 'update'
[DELETE] localhost:80/api/alunos/{id} -> 'remove'
```

```js
-------------------------------
------ [CLASSROOM ROUTES] -----
-------------------------------
[GET] localhost:80/api/turmas/{id}/alunos -> 'getAllStudentsByClassroom'
[POST] localhost:80/api/turmas -> 'create'
[PUT] localhost:80/api/turmas/{id} -> 'update'
[DELETE] localhost:80/api/turmas/{id} -> 'remove'
```

(back to top)

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/amazing-feature`)
3. Commit your Changes (`git commit -m 'feat: add some amazing feature'`)
4. Push to the Branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

(back to top)

## License

Distributed under the MIT License. See [LICENSE](./LICENSE) for more information.

(back to top)

## Contact

[![Website](https://img.shields.io/badge/-Website-0078D4?style=flat-square&logo=html5&logoColor=white&link=https://lucasreinaldi.com.br)](https://rinaldilucas.com)
[![Github](https://img.shields.io/badge/-Github-967bb5?style=flat-square&labelColor=967bb5&logo=github&logoColor=white&link=https://github.com/rinaldilucas)](https://github.com/rinaldilucas)
[![Gmail Badge](https://img.shields.io/badge/-Gmail-c14438?style=flat-square&logo=Gmail&logoColor=white&link=mailto:[email protected])](mailto:[email protected])
[![Hotmail Badge](https://img.shields.io/badge/-Hotmail-0078D4?style=flat-square&logo=microsoft-outlook&logoColor=white&link=mailto:[email protected])](mailto:[email protected])
[![Linkedin Badge](https://img.shields.io/badge/-LinkedIn-blue?style=flat-square&logo=Linkedin&logoColor=white&link=https://www.linkedin.com/in/rinaldilucas/)](https://www.linkedin.com/in/rinaldilucas/)
[![Telegram Badge](https://img.shields.io/badge/-Telegram-1ca0f1?style=flat-square&labelColor=1ca0f1&logo=telegram&logoColor=white&link=https://t.me/rinaldilucas)](https://t.me/rinaldilucas)

Project Link: [https://github.com/rinaldilucas/laravel-school-api](https://github.com/rinaldilucas/laravel-school-api)

(back to top)

## Donations

If you feel that this project has helped you in any way, whether it's attracting clients or teaching you about the technologies used, feel free to make a donation.
It helps me a lot to continue developing open source codes.

- Metamask (USDT):
```sh
0x16362DF7f963CeEBB2114B467B68F5A58972ee65
```
- PIX (BRL):
```sh
72140bc8-fadc-42f5-abb6-9c13cc80a59f
```

(back to top)

[contributors-shield]: https://img.shields.io/github/contributors/rinaldilucas/laravel-school-api.svg?style=for-the-badge
[contributors-url]: https://github.com/rinaldilucas/laravel-school-api/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/rinaldilucas/laravel-school-api.svg?style=for-the-badge
[forks-url]: https://github.com/rinaldilucas/laravel-school-api/network/members
[stars-shield]: https://img.shields.io/github/stars/rinaldilucas/laravel-school-api.svg?style=for-the-badge
[stars-url]: https://github.com/rinaldilucas/laravel-school-api/stargazers
[license-shield]: https://img.shields.io/github/license/rinaldilucas/laravel-school-api.svg?style=for-the-badge
[license-url]: https://github.com/rinaldilucas/laravel-school-api/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/rinaldilucas/
[project-screenshot]: ./public/images/screenshot.jpg