A Laravel application that displays random Kanye West quotes using the Kanye REST API. Built with Laravel, Livewire, and Tailwind CSS.
- Displays 5 random Kanye West quotes
- Auto-refresh functionality with countdown timer
- Real-time quote updates using Livewire
- Responsive design with Tailwind CSS
- Error handling for API failures
- Unit and Feature tests
- RESTful API endpoint for quotes
- Docker containerization with Laravel Sail
- Docker
- Docker Compose
- PHP 8.2+
- Composer
- Node.js & NPM
- Clone the repository: https://github.com/Valere3162/laravel-livewire-coding-test.git
- Unit tests are in the
tests/Unit
folder. - Feature tests are in the
tests/Feature
folder.
The application uses Laravel Sail, which provides a Docker-based development environment. The following services are included:
- PHP 8.3
- MySQL 8.0
- Node.js for asset compilation
The application runs with the following Docker services:
-
Laravel Application (laravel.test):
- PHP 8.3 runtime
- Exposed on port 8080
- Includes Vite dev server on port 5173
-
MySQL Database:
- MySQL 8.0
- Exposed on port 3306
- Includes automatic testing database setup
The application integrates with the Kanye REST API (https://api.kanye.rest/) to fetch random Kanye West quotes.
The application provides its own REST API endpoint:
- GET
/api/quotes
: Returns an array of 5 random Kanye West quotes
app/Livewire/Quotes.php
: Main Livewire component for quote display and refreshresources/views/livewire/quotes.blade.php
: Quote display templateapp/Http/Controllers/QuoteController.php
: API endpoint controllertests/Feature/QuotesPageTest.php
: Feature tests for quotes functionalitytests/Unit/QuotesComponentTest.php
: Unit tests for Quotes component
- Tailwind CSS for styling
- Livewire for real-time updates
- Vite for asset compilation
The application includes comprehensive error handling:
- API failure detection and user feedback
- Graceful degradation when quotes cannot be fetched
- Error logging for debugging
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is open-sourced software licensed under the MIT license.
git clone <repository-url>
cd quotes-app
composer require laravel/sail --dev
cp .env.example .env
./vendor/bin/sail up -d
./vendor/bin/sail composer install
./vendor/bin/sail npm install
./vendor/bin/sail artisan key:generate
Open a new terminal and run:
./vendor/bin/sail artisan session:table
./vendor/bin/sail artisan migrate
check if migrations are successful:
./vendor/bin/sail artisan migrate:status
navigate to the application
http://0.0.0.0/quotes