mikespub/epub-loader

epub-loader is a utility resource for ebooks

3.5.11 2024-11-17 21:03 UTC

README

Prerequisites for this fork

  • PHP 8.x with DOM, GD, Intl, Json, PDO SQLite, SQLite3, XML, Zip and ZLib support (PHP 8.2 or later recommended)
  • Release 3.x.x will only work with PHP >= 8.2 - typical for most source code & docker image installs in 2024 and later
  • 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, 2.x and 3.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.

It supports multiple databases defined by name, database path and epub path where its ebooks are located. You can create new Calibre-compatible databases with EPub Loader, or use existing Calibre databases from elsewhere.

Main features are:

  • Import:
    • create Calibre database with available ebooks
    • import CSV/JSON records into new Calibre database
    • load JSON files from Lookup cache into new Calibre database
  • Export:
    • export CSV/JSON records with available ebooks
    • dump CSV/JSON records from Calibre database
    • export metadata cache via callbacks to your own application
  • Lookup:
    • match ebooks and authors with WikiData
    • match ebooks and authors with Google Books
    • match ebooks and authors with OpenLibrary
    • match ebooks and authors with GoodReads
    • explore content of metadata cache
  • Extra:
    • check book links by identifier type
    • get existing notes from Calibre notes.db
    • update ebook metadata with mikespub/php-epub-meta
    • run extra actions defined in your own application

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, dbNum and urlParams if any

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

// handle the result yourself or let epub-loader generate the output
$result['endpoint'] = 'index.php/loader';
$result['app_name'] = 'My EPub Loader';
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
class ExtraActions extends ActionHandler
{
    // ...

    public function more()
    {
        // do some more...
        return [
            'result' => 'This is more...',
            'extra' => 'easy',
        ];
    }
}

License & Copyright

This package is available under the GNU General Public License v2 or later - see LICENSE

EPub Loader was first distributed as resource for COPS - Calibre OPDS (and HTML) PHP Server. This fork is now a separate package that can work alone or be integrated with other web applications.

Copyright (C) 2013-2021 Didier Corbière Copyright (C) 2023- mikespub