Code Monkey home page Code Monkey logo

php-commento's Introduction

PHP-Commento

This is an alternative PHP backend for the the Commento comments engine.

Commento is a lightweight, open source, tracking-free comment engine alternative to Disqus written in Go and Javascript.

This PHP backend is a simple PHP implementation that can be installed on any "modern" shared hosting and stores the comments in Json files. On the client side, it uses the Commento Javascript libraries.

Features

  • Threaded comments on any website.
  • Store the comments on your own server.

Requirements

  • tested with PHP 7.0+ and PHP 5.6+ (but might work with PHP 5.4+)

Installing

  • Get the latest php-Commento.tar released package and unpack it.

  • Create a data/ directory and set it in the COMMENTO_DATA_PATH constant in the index.php file (by default, data/ will be used).

  • Install PHP-Commento by calling the install route.

  • Add PHP-Commento to your HTML page(s):

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <script src="http://www.the-url-with.your/php-commento/js/commento.js"></script>
      </head>
      <body>
        <div class="content">
          <p>... Your content...</p>
        </div>
    
        <div id="commento">
          <!-- Commento will populate this div with comments -->
        </div>
    
        <script>
          Commento.init({
            serverUrl: "http://www.the-url-with.your/php-commento"
          })
        </script>
      <body>
    </html>

Packaging / Installing from the sources

If needed, you can minify the Javascript and CSS and Javascript with minifier.org.

The file structure

The src/ directory

The src/ directory contains the commento.php file with the PHP-Commento engine.

The sample/ directory

The sample/ directory contains

The data/ directory

data/url.json
data/comments/
data/comments/*.json

The routes

The Comment routes:

/
    - not implemented yet
    - sets w.Header().Set("Access-Control-Allow-Origin", "*")

/assets
    - not implemented

/create
    - post, form:
        - url: string, where the comment is coming from
        - comment: string, the comment
        - name: string, the name
        - parent: int, -1 if none
    - reply, json:
        - {
              "success":true,
              "message":"Comment successfully created"
          }

/get
    - post, form:
          - string url: where the comment is coming from
    - reply, json:
      {
          "success":true,
          "message":"",
          "comments":
              [
                  {
                      "id":1,
                      "url":"http://ww.impagina.org/commento/commento.html",
                      "comment":"this is a test",
                      "name":"ale",
                      "timestamp":"2017-05-12T08:32:04.333415146+02:00",
                      "parent":-1
                  }
              ]
      }
       

The routes are defined in http.go:GetCommentsHandler

Additional PHP-Commento routes:

/install

php-commento's People

Contributors

aoloe avatar

Watchers

 avatar  avatar

php-commento's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.