Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

A Laravel News API. This application gets data about all available news, also breaking news in different countries. It uses Laravel Contextual Binding to knows what it's required.

Notifications You must be signed in to change notification settings

joslmt/laravel-general-news-application

Repository files navigation

Laravel - NewsAPI

What is 📝

It's a web that uses NewsAPI like main API to get differents news about something particular or some topic like health. This app provides two types of search, the first one it's about searching some concret thing, the other gets latest news.

Project purpose ℹ️

The goal was to dive into concepts like Service Provider and Service Container, also other of the purposes was to enhance SOLID principles like Interface Segretation Principle (IS) and Dependency Inversion Principle (DIP).

What makes it different ?

It's not like other applications that have a strong dependency with a specific API, this app offers to the users the ability to change over API news with a few modifications, thanks to Interface Segregation Principle

What uses ℹ️

It's easy, just :

  • Laravel 8 with the last available version at the moment Laravel .
  • Laravel Breeze for handle authentication features, Laravel Breeze .
  • But also MySQL and SQLite.

Screenshots

Some pictures about the app :

home

latest

results

How to install ❓

Clone the repository and install project dependencies with :

git clone git@github.com:joslmt/news-api.git

composer install

How to configure it ❓

It's necessary gets a .env file, so writte in console :

cp .env.example .env

Now, generate an own key for your project :

php artisan key:generate

Finally, push your database config within .env .

   DB_CONNECTION=mysql
   DB_HOST=
   DB_PORT=3306
   DB_DATABASE=
   DB_USERNAME=
   DB_PASSWORD=

Get an API key

Just go to NewsAPI and click 'Get API Key' .

How to execute ❓

There're some options, if you use something like XAMPP or similar :

php artisan serve

Or a good alternative like Docker or Homestead like me, take a look to one of my previous projects where I explained the steps to get Homestead installed. How to install Homestead for Laravel.

Testing

To test the app I decided to use SQLite, just for speed. It's required to get a new .env where config the database options to SQLite and also create a SQLite database.

touch database/database.sqlite
cp .env.example .env.testing

Then, within .env.testing replace database variables with :

DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database.sqlite

Finally :

php artisan test --env=testing

And don't forget to put your API key.

About

A Laravel News API. This application gets data about all available news, also breaking news in different countries. It uses Laravel Contextual Binding to knows what it's required.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published