Skip to content

About

A simple and lightweight API for managing newsletter subscriptions, built with

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Slim PHP Newsletter API

A simple and lightweight API for managing newsletter subscriptions, built with Slim Framework and PHP.

Features

  • Easy integration with any frontend
  • RESTful endpoints for subscribing and unsubscribing
  • Minimal dependencies and fast setup

Getting Started

  1. Clone the repository:
    git clone https://github.com/crossben/slim-php-newsletter.git
    cd slim-php-newsletter
  2. Install dependencies with Composer:
    composer install
  3. Configure your environment:
    Copy .env.example to .env and update settings as needed.
  4. Start the API server:
    php -S localhost:8080 -t public

API Endpoints

Subscribe

  • Endpoint: POST http://localhost:8080/subscribe/{email}
  • Request Body:
    {
       "email": "example@example.com"
    }
  • Success Response:
    {
       "message": "Subscribed successfully!"
    }

Unsubscribe

  • Endpoint: DELETE http://localhost:8080/unsubscribe/{email}
  • Example:
    http://localhost:8080/unsubscribe/example@example.com
  • Success Response:
    {
       "message": "Unsubscribed successfully!"
    }
  • Error Responses:
    {
       "error": "Email not found"
    }
    {
       "error": "Invalid email"
    }

License

MIT License

About

A simple and lightweight API for managing newsletter subscriptions, built with

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages