mikespub/epub-loader

epub-loader is a utility resource for ebooks

3.0.0 2024-03-14 19:10 UTC

README

Prerequisites for this fork

  • PHP 8.x with DOM, GD, Intl, Json, PDO SQLite, SQLite3, XML, XMLWriter and ZLib support (PHP 8.1 or later recommended)
  • Release 2.x.x will only work with PHP >= 8.1 - typical for most source code & docker image installs in 2023 and later
  • Release 1.x.x still works with PHP 7.4 if necessary - earlier PHP 7.x (or 5.x) versions are not supported with this fork

Dependencies

They have the same PHP version dependencies for 1.x and 2.x releases

Description

epub-loader is a utility package for ebooks. It can be used as a stand-alone project or included in your own PHP application

  • CalibreDbLoader class allows create Calibre databases and add ebooks
  • BookExport class allows to export ebooks metadata in csv files
  • WikiDataMatch class allows to match ebooks and authors with Wikidata
  • GoogleBooksMatch class allows to match ebooks and authors with Google Books
  • OpenLibraryMatch class allows to match ebooks and authors with Open Library
  • The app directory contains samples and allows to run actions

Installation (stand-alone)

composer create-project mikespub/epub-loader
  • If a first-time install, copy app/config.php.example to app/config.php
  • Edit config.php to match your config
  • Open the app directory url: ./app/index.php

Installation (included)

composer require mikespub/epub-loader
  • Run composer install -o to install all package dependencies and optimize autoloader if needed
  • You can use Marsender\EPubLoader\RequestHandler to handle the request like in ./app/index.php
use Marsender\EPubLoader\RequestHandler;

// get the global config for epub-loader from somewhere
// get the current action and dbNum if any

// you can define extra actions for your app - see example.php
$handler = new RequestHandler($gConfig, ExtraActions::class);
$result = $handler->request($action, $dbNum);

// handle the result yourself or let epub-loader generate the output
$result['endpoint'] = 'loader.php';
$result['app_name'] = 'My Application';
echo $handler->output($result, $templateDir, $template);

Adding extra actions

  • You can add extra actions on databases and/or epub files as shown in ./app/example.php
public function more()
{
    // do some more...
    return [
        'result' => 'This is more...',
        'extra' => 'easy',
    ];
}