OPDS PHP Ebook Publisher Class: Publish and distribute ebooks for download

Recommend this page to a friend!
  Info   Documentation   Screenshots   View files (49)   Download .zip   Reputation   Support forum (1)   Blog (2)    
Last Updated Ratings Unique User Downloads Download Rankings
2020-06-08 (1 month ago) Not yet rated by the usersTotal: 125 This week: 10All time: 9,109 This week: 22
Version License PHP version Categories
opdsclass 0.1GNU General Publi...5PHP 5, Files and Folders, Content man...
Description Author

This class can be used to publish and distribute ebooks for download.

It provides classes that can be used to publish ebooks file that can be viewed well either in computers and mobile phones.

It supports ebooks with different possible formats like PDF, EPUB, MOBI, AZW3, etc..

The package also provides management scripts to feed the database with new publications.

Innovation Award
PHP Programming Innovation award nominee
June 2020
Number 5
Ebooks are nowadays a common means of distribution of books in a digital format that can be downloaded in computers or mobile phones and tablets.

This package provides a complete solution for publishing and distributing books in multiple ebook formats used by different systems.

Manuel Lemos
Picture of Pierre FAUQUE
  Performance   Level  
Name: Pierre FAUQUE <contact>
Classes: 14 packages by
Country: France France
Age: 73
All time rank: 16711 in France France
Week rank: 5 1 in France France
Innovation award
Innovation award
Nominee: 8x

Winner: 1x

Details
                               OPDS Classes
                       Version 0.1 of May 17, 2020

                       -----===oooOO$OOooo===-----


    1. GENERAL
      1.1. Constraints

    2. PACKAGE
      2.1. What the package contains
          2.1.1. Restrictions
      2.2. What the package does not contain and what you will need

    3. IMPLEMENTATION

    4. ADVICE

    5. CREATE YOUR OWN EBOOKS



1. GENERAL
==========

In the rest of this document we will call ebook any digital document in
different formats (EPUB, MOBI, PDF, AZW3, etc.)

An OPDS system (Open Publication Distribution System) makes it possible to
offer a catalog of ebooks on a web server. These are classified by category
(e.g. Literature), subcategory (e.g. Theater), document (e.g. Le Cid). You
can consult the catalog according to the most recent publications or by
theme and download the chosen ebook among the proposed formats.

This catalog can be used for consultation and download :

-- Either from a smartphone or a tablet (which we will call device) with an
   embedded browser or better with an ebook reader (which is designed for
   this),

-- Or from a computer.

From a hardware or another, you will need on it the software or softwares
capable of reading ebooks in their format. We almost all have Acrobat
Reader on our computer to read PDF files, you will probably need another
software to read other formats (EPUB, MOBI, AZW3, etc.). The downloaded
ebooks can also be transfered to a commercial e-reader.

For your devices, you will probably find them on Google Play for Android
devices or Apple Store for Apple devices.

  1.1. Constraints
  ----------------

Catalogs are presented using XML files. The ebook-readers for devices are
designed to read these XML files (encoded in UTF-8) and the old browsers
were able to interpret the XML files which allowed the consultation of
these catalogs either from an ebook-reader, or from a web browser (on
computer or on device).

Mozilla Firefox, since version 56 (December 2018) has abandoned the
interpretation of XML. The other browsers followed and they have also
abandoned it since. As a result, with a current browser, the XML files
are no longer interpreted and are displayed as they are coded with the
information that no style sheet is associated with this XML file.


2. PACKAGE
==========

The package you downloaded from PHP Classes allows you to set up and offer
your visitors such a catalog of ebooks on your website.

    1.1. What the package contains
    ------------------------------

It contains, to consult the catalog of ebooks that you can offer and download
from it, two classes of PHP objects. Already integrated in PHP scripts :

-- index.php: contains the class that produces the XML necessary for use
   and download from a device ebook reader (smartphone or tablet)

-- ebooks.php: contains the class which produces the HTML necessary to do
   the same thing from a browser (computer or device) since these do not
   accept any more XML. This class (in the ebooks.php script) uses a style
   sheet: wopds.css, also provided, which you can modify if the
   presentation does not suit you.

-- A set of management files used to feed the database (MySQL, PostreSQL,
   mSQL, SQLite or any other database managed by the PDO API of PHP.

-- An SQL script allowing to create the necessary tables for the management
   of this catalog in a database created for this use or in an already
   existing database. There will be no confusion in the tables because they
   all start with the prefix opds_* (opds_Documents, opds_Authors, etc.)

The possibility is offered in the database, for various reasons which will
be yours, to hide one or more documents, one or more subcategories or one
or more complete categories of documents.

          1.1.1. Restrictions

PHP Classes is a PHP class repository, not an application repository. For
this reason, the management scripts used to feed this database do not
constitute a complete, professional application. It allows ONLY the
addition in the database but not the modifications, the main part of the
package being the OPDS classes (for ebook-readers and for web browsers).

Reason why, add only if you have all the information. If you have forgotten
or want to make changes to what has already been entered, use an interface
such as phpMyAdmin or similar to work directly in the database.

However, in the very near future, the scripts that make up the management
package will be used to add to their addition functionality, the
possibility of modifying existing records.

    1.2. What the package does not contain and what you will need
    -------------------------------------------------------------

If you are setting up such a catalog, you will need ebooks to make it work.
As PHP Classes is not an ebook repository, you can download a test set of
files from my website at:

     http://www.fauque.fr/dnl.php?f=182be0c5cdcd5072bb1864cdee4d3d6e

This ZIP file contains 3 documents (4 ebooks) and 2 thumbnails:

-- Cyberspace Declaration of Independence (EPUB and MOBI) + 1 thumbnail
-- Sigil version 0.7.2 User guide (EPUB)
-- Sigil version 0.9.15 User guide (EPUB) + the same thumbnail for both

The script for creating the necessary tables for managing the OPDS catalog
mentioned above already contains the information concerning these three
documents. You will not have to enter them but just put the downloaded
files in their place


3. IMPLEMENTATION
=================

I checked the procedure and it is operational. To make your tests, keep the
organization and the names which are proposed to you. When you have fully
assimilated the whole system, you will choose your own organization by
making the modifications (possibly in the scripts) that you deem useful.

-- On your hard drive create a directory called opds.

-- Unzip the entire downloaded package in this opds directory. This will
   create other subdirectories in it (authors, ebooks, management, img)
   containing files themselves.

-- Download from my website as indicated in the previous paragraph the zip
   file containing the test ebooks and unzip it in the opds directory of
   your hard drive (the ebooks and the thumbnails will be put in their
   respective places).

-- Open the file index.php (OPDS class for use by ebooks-readers) and
   modify the lines 48 to 55 to put your information (type of database,
   contact details for connection to the tables of your database)

-- Open the file ebooks.php (OPDS class for use by a browser) and modify
   the lines 49 to 56 to put your information (type of database, contact
   details for connection to the tables of your database) and the two
   lines 85 to 87 if, for some reason, you need to rename the ebooks.php,
   wopds.css or background-image files, otherwise, do not rename them.

-- Open the gestion/init.php file (located in the gestion subdirectory)
   and modify the lines 26 to 33 to modify your information (type of
   database, contact details for connection to the tables in your
   database).

-- Connect via FTP to your web server and transfer the opds directory and
   all its contents from your hard drive to the root of your web server.
   The opds directory will be the rootopds of your catalog. Your entire
   catalog is contained in this directory and in the database tables.
   Deleting the two (directory with their content and tables) will delete
   the complete OPDS system from your site.
  
-- use the opds.sql file to build tables and feed them with the necessary
   informations that are in this SAL script
   
-- Go to catalog management (the address just above) and start by
   configuring your catalog first (name, first name, email, etc.).
   Now read the documentation on the MCD site, Help, etc.

-- NB: The addresses to be used will be the following:
   For an ebook-reader:           http://www.yoursite.com/opds
   For a web browser:             http://www.yoursite.com/opds/ebooks.php
   For catalog management (adds): http://www.yoursite.com/opds/gestion

-- As soon as possible create the .htaccess and .htpasswd files mentionned
   in the help to protect your management directory.

If you follow this procedure exactly, you will obtain the same demo catalog
which is in:

-- http://www.fauque.fr/gopds  for ebook-readers of smartphones and tablets
-- http://www.fauque.fr/gopds/ebooks.php  for web browsers

Familiarize yourself with the catalog (on computer as on device), with the
creation of ebooks and put online your creations.

Any return message or request for help to my email address or here, on
PHP Classes, are welcome.


4. ADVICE
=========

For script modification (entering your login information or modifying the
code), be sure to use a text editor reading and recording in UTF-8. The
same goes for the database.

If you do not respect this encoding, the scripts will still work, maybe
with an altered display on the web, but they will cause a dead-lock error
with book-readers.


5. CREATE YOUR OWN EBOOKS
=========================

If you have a little HTML knowledge, you can relatively easily create your
own ebooks (Documentation, cooking recipes, poetry, instructions, etc.) to
always have them with you on your smartphone.

Indeed, an ebook in EPUB format is a set of zipped XHTML files. You can
also use Winzip to watch the content format and see how it is designed and
then be inspired by it to create your own.

You can download it from its original site or from the portable applications
site to install it on a USB key and be able to use it everywhere:

-- https://sigil-ebook.com (original site)
-- https://portableapps.com/apps/office/sigil-portable (portable application)

Have fun.

-----
05/30/2020. Pierre FAUQUE, pierre@fauque.net

Screenshots  
  • scr1_phone.jpg
  • scr2_phone.jpg
  • scr3_phone.jpg
  Files  
File Role Description
authors (1 file)
ebooks (1 file)
gestion (38 files)
img (3 files)
index.php Class Main OPDS Class for ebook-readers
ebooks.php Class Main OPDS Class for the web
wopds.css Data Style sheet
opds.sql Data Script to build the database
README_FIRST.txt Doc. Documentation
ABOUT.txt Data About the class and author

  Files  /  authors  
File Role Description
   index.php Appl. Script of application

  Files  /  ebooks  
File Role Description
   index.php Appl. Script of application

  Files  /  gestion  
File Role Description
   add_auth.php Appl. Script of application
   add_cat.php Appl. Script of application
   add_doc.php Appl. Script of application
   add_kw.php Appl. Script of application
   add_scat.php Appl. Script of application
   add_type.php Appl. Script of application
   doc_about.php Appl. Script of application
   doc_browsers.php Appl. Script of application
   doc_cmd.jpg Photo Image: Conceptual Model of Data
   doc_cmd.php Appl. Script of application
   doc_ddic.php Appl. Script of application
   doc_files.php Appl. Script of application
   doc_help1.php Appl. Script of application
   doc_help2.php Appl. Script of application
   doc_help3.php Appl. Script of application
   doc_help4.php Appl. Script of application
   doc_help5.php Appl. Script of application
   doc_help6.php Appl. Script of application
   doc_help7.php Appl. Script of application
   doc_license.php Appl. Script of application
   doc_screens.php Appl. Script of application
   doc_struct.php Appl. Script of application
   doc_todo1.php Appl. Script of application
   doc_todo2.php Appl. script of application
   doc_todo3.php Appl. Script of application
   functions.js Appl. Script of application
   index.php Appl. Script of application
   init.php Appl. Script of appication
   lib_lddocs.php Appl. Script of application
   menu.txt Appl. Script of application
   menu_help.php Appl. Script of application
   menu_todo.php Appl. Script of application
   opds.css Appl. Script of application
   rel_authdoc.php Appl. Script of application
   rel_dockw.php Appl. Script of application
   rel_pubdoc.php Appl. Script of application
   set_conf.php Appl. Script of application
   tool_vieweb.php Appl. Script of application

  Files  /  img  
File Role Description
   background.jpg Photo Image of the background of a web page
   marble.jpg Photo Image background
   index.php Appl. Script of application

 Version Control Unique User Downloads Download Rankings  
 0%
Total:125
This week:10
All time:9,109
This week:22

For more information send a message to info at phpclasses dot org.