This is a simple subscription platform API built with Laravel. The platform allows users to subscribe to websites and receive email notifications for new posts.
To get started with the project, follow the instructions below.
- PHP >= 7.4
- Composer
- MySQL
- Clone the repository:
git clone https://github.com/edriso/subscription-platform.git
- Navigate to the project directory:
cd subscription-platform
- Install the dependencies:
composer install
- Create a copy of the
.env.example
file and rename it to.env
:
cp .env.example .env
- Generate an application key:
php artisan key:generate
- Configure your database connection in the
.env
file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
- Configure your mail connection in the
.env
file:
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=tls
- Run the database migrations:
php artisan migrate
- Seed the database with sample data (optional):
php artisan db:seed
- Start the development server:
php artisan serve
- To send post emails to subscribers, run the following command:
php artisan posts:send-emails
This command will check all websites and send new posts to subscribers who haven't received them yet. It ensures that no duplicate stories are sent to subscribers.
- This application utilizes queues to handle background processing of tasks such as sending emails. To start processing the queues, run the following command:
php artisan queue:work