Home >Backend Development >PHP Tutorial >PHP Supabase Comments

PHP Supabase Comments

Barbara Streisand
Barbara StreisandOriginal
2025-01-22 12:08:11844browse

Hi all! ?

After a long year, I’m finally publishing a post on dev.to!

I’ve created a simple comment system built using PHP and Supabase. This project was inspired from Supacomments dev by @mcnaveen - Blazing fast comment system with Sveltejs and Supabase

Features

  • PHP (7.4 to 8.x.x) support
  • Supabase for storing comments in the database
  • Pagination for comments
  • Modern and responsive UI using Bulma CSS
  • Comprehensive security for input forms and spam prevention
  • Cloudflare Turnstile for additional spam protection

This project is completely free and open-source! Feel free to fork the GitHub repository and customize according it to your needs. ?

GitHub logo mskian / php-supabase-comments

A Simple Comment system built using PHP and Supabase.

PHP Supabase Comments

A simple comment system built with PHP and Supabase.

Features

  • PHP (7.4 to 8.x.x) support
  • Supabase for storing comments in the database
  • Pagination for comments
  • Modern and responsive UI using Bulma CSS
  • Comprehensive security for input forms and spam prevention
  • Cloudflare Turnstile for additional spam protection

setup

  • Create a database in Supabase: https://supabase.com/docs/guides/database/overview
<span>-- Create the table with necessary fields</span>
CREATE TABLE user_comments (
    id SERIAL PRIMARY KEY,            <span>-- Auto-incrementing primary key</span>
    name VARCHAR(255) NOT NULL,        <span>-- Name of the user (max length 255)</span>
    comment TEXT NOT NULL,            <span>-- Comment field to store user input</span>
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP <span>-- Timestamp with timezone</span>
);
Enter fullscreen mode Exit fullscreen mode
  • Also, create Cloudflare Turnstile: https://developers.cloudflare.com/turnstile/
  • Create a .env file to add the required API keys
<span>## Supabase</span>
supabaseUrl=https://example.supabase.co
apiKey=
pkey=
table=comments
<span>## Cloudflare turnstile</span>
secretKey=
Enter fullscreen mode Exit fullscreen mode
View on GitHub

The above is the detailed content of PHP Supabase Comments. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn