Maqalat is a completely functional API with CRUD functionality whose features can be tested. Setting it up will create 30 Fake Articles with an id
, title
and body
along with an author_url
currently set to https://imtiazraqib.com
-
Open XAMPP Control Center and start the Apache Server and MySQL server
-
Clone the repository
-
Open the repository folder using VS Code or your preferred code editor and navigate to
.env
file- The
.env
will not exist, so create a new file and use the.env.example
template to fill it up and follow along - Under
DB_CONNECTION=mysql
make sure the following are as below:DB_DATABASE=maqalat
DB_USERNAME=root OR $your username$
DB_PASSWORD= $your password$
or leave it empty if you have no password
- The
-
To route Laravel homepage to
maqalat.test
, follow the steps below:- go to
../xampp/apache/conf/extra
and openhttpd-vhosts.conf
with an editor - Input this at the bottom of the
httpd-vhosts.conf
file:
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/maqalat/public" ServerName maqalat.test </VirtualHost>
- Open Notepad or the equivalent in your OS as administrator
- Open a file similar to this syntax that can be found in Windows -
C:\Windows\System32\drivers\etc
- Make sure All Files option is selected and open the
hosts
file - Add this at the bottom of the comments - 127.0.0.1 maqalat.test
- go to
-
The steps provided below are taken from Traversy Media's Larticles API
- Open a terminal within the repository
- Install dependencies by
composer install
- Generate an encryption key, run
php artisan key:generate
- Run Migrations by
php artisan migrations
- Import Articles by
php artisan db:seed
-
Fire up a browser and type in
http://maqalat.test
and it is working if you see the Laravel logo- Check if the database is populated by the seeded articles by going to
http://maqalat/api/articles
- Check if the database is populated by the seeded articles by going to
-
Fire up Postman or your choice of API tester (Although Postman is pretty cool, not sponsored! 😢)
-
Below is the workflow for Postman:
- POST -> http://maqalat.test/api/article
- Add a new Header with Key = Content-Type and Value = application/json
- Body follows a
raw
format as shown below
{ "title":"Whatever is your new title", "body":"Whatever you wanna keep as the new body" }
- GET -> http://maqalat.test/api/articles
- PUT -> http://maqalat.test/api/article
- Add a new Header with Key = Content-Type and Value = application/json
- Body follows a
raw
format as shown below
{ "article_id": 4, "title":"Whatever is your UPDATED title", "body":"Whatever you wanna keep as the UPDATED body" }
- The
article_id
is theid
of the article that you want to update with the followingtitle
andbody
- DEL -> http://maqalat.test/api/article/{id}
- Replace
{id}
with the actual article id you want to delete.
- Replace
- POST -> http://maqalat.test/api/article
The project is setup personally for me to learn Laravel and familiarize myself with the framework. The project would not have been possible without the tutorial from Traversy Media over at YouTube. His video titled, Laravel 5.5 API From Scratch Using Resources is what I used personally to follow along and learn the fundamentals of Laravel.
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
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.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.
- Vehikl
- Tighten Co.
- Kirschbaum Development Group
- 64 Robots
- Cubet Techno Labs
- Cyber-Duck
- British Software Development
- Webdock, Fast VPS Hosting
- DevSquad
- UserInsights
- Fragrantica
- SOFTonSOFA
- User10
- Soumettre.fr
- CodeBrisk
- 1Forge
- TECPRESSO
- Runtime Converter
- WebL'Agence
- Invoice Ninja
- iMi digital
- Earthlink
- Steadfast Collective
- We Are The Robots Inc.
- Understand.io
- Abdel Elrafa
- Hyper Host
- Appoly
- OP.GG
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.