This a submission of task for the role of Senior full-stack PHP developer at Eskimi. Task description can be found here.
- Create and edit advertising campaign
- List all created advertising campaigns: name, date, daily budget, total budget
- Multiple image upload with the advertising campaign
- Preview of each advertising campaign
- API endpoint to list campaigns
- API endpoint to create new campaign
- Laravel - PHP framework
- Vue3 - Javascript frontend framework
- Nginx - An open source web server
- MySQL - Database service
- Redis - Data storage for cache.
In addition to the Laravel framework, the following dependencies were also used in the application:
- InertiaJS - A library that allows you to render single-file Vue components from your Laravel backend.
- Jetstream - Application starter kit for Laravel.
- Sanctum - Laravel package that provides a featherweight authentication system.
- Ziggy - Provides helper functions to access all of our named Laravel routes from the frontend.
- TailwindCSS - A utility-first CSS framework.
Docker containers were used to setup the environment, thanks to Laradock.
Docker version used: Docker Desktop version 20.10.8
Follow the instructions to set up the app in Docker.
git clone --recursive https://github.com/adedayomatt/eskimi-ssp.git
cd eskimi-ssp
copy .env.example .env
cd laradock
copy .env.example .env
We need nginx, mysql, redis and workspace containers running. The workspace container already contains necessary softwares requires to successfully run a Laravel project, e.g PHP CLI, Composer, Node, e.t.c.
docker-compose up -d nginx mysql workspace redis
docker-compose exec workspace bash
Continue running the following commands In the workspace bash...
composer install
php artisan key:generate
php artisan migrate
This create a user account to login in with and some sample campaigns
php artisan db:seed
php artisan storage:link
npm install
npm run prod
In app .env file, set the following...
DB_CONNECTION=mysql
DB_HOST=mysql
DB_DATABASE=default
DB_USERNAME=root
DB_PASSWORD=root
CACHE_DRIVER=redis
REDIS_HOST=redis
QUEUE_HOST=beanstalkd
The app should now be running at the address:
http://localhost
Login to the system with the credentials already seeded.
Email: [email protected] Password: eskimi
For API authentication, an access token needs to be created at http://localhost/user/api-tokens
with the right permissions; by default, read
and create
permissions are added to allow listing of campaigns and creating new campaign respectively via API.
Copy the token and pass it as Bearer token in request header.
API | Path | Verb |
---|---|---|
Authenticated user | /api/user | GET |
List of campaigns | /api/campaigns | GET |
Single campaign | /api/campaigns/{campaign_id} | GET |
Create new campaign | /api/campaigns/store | POST |
The following tests are available:
- User authentication
- Creating of API token
- Deleting of API token
- Password reset and update
- Updating of Profile information
- Listing campaigns via web and api
- Creating new campaign via web and api
- Updating campaign via web an api
Run test:
php artisan test
To ensure the code extensibility and maintainablility, the code base was designed in modules such that other features can be built in as separate modules and be maintained independently. To achieve this, the modules
directly was added to Laravel file structure which would house different modules in the application. The campaign module was created and structured to contain models, controllers, routes, migrations, requests, views and components for campaign.
The campaign service provider was created to configure the module and is registered with the application in config/app
The modules directory was added to the psr-4 autoload with a namespace here
=============================================================================================================================
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
- Many
- Webdock, Fast VPS Hosting
- DevSquad
- Curotec
- OP.GG
- CMS Max
- WebReinvent
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 [email protected]. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.