Download the PHP package dilneiss/php-ebook-generator without Composer

On this page you can find all versions of the php package dilneiss/php-ebook-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-ebook-generator

PHP Ebook Generator

PHP Ebook Generator is a PDF book generator which accepts Markdown, currently in development. I've already used it to generate budget proposal and books and it was very functional.

Instalation

To install, download the zip or use Composer:

composer require webdevbr/php-ebook-generator dev-master

Use

You create the ebook using an entity, configure Dompdf and inject it on the object responsible of generate the PDF, the make command finalizes the process.

For example, create a file named example.php and configure as follows:

In this repository has this example ready to execute, just clone (or download) and run php example.php in the root of the project.

<?php

/** Gerador de livros em PDF */

require 'vendor/autoload.php';

/**
 * O componente aceita strings, então você pode puxar os dados do banco de dados
 * ou diretamente de um arquivo local, ou até escrever em uma variável para incluir,
 * nestes exemplos estou utilizando o file_get_contents() para ter acesso ao conteúdo
 * de um arquivo local, mas qualquer string vai bem ali.
 */

//Eu uso esta entidade para construir a estrutura do meu livro
$book = new WebDevBr\Ebook\BookEntity;

//adiciono a capa
$book->addCover(file_get_contents('example/cover.md'));

/**
 * Uma informação a ser exibida antes do livro começar
 * por exemplo: sobre o autor ou prefacio
 * não aparece no indice
 */
$book->addBefore(file_get_contents('example/intro.md'));

//adiciono os capítulos do livro
$book->addChapter(file_get_contents('example/cap1.md'));
$book->addChapter(file_get_contents('example/cap2.md'));

/**
 * E algo que eu queira mostrar no final do livro
 * por exemplo: bibliogragia
 * não aparece no indice
 */
$book->addAfter(file_get_contents('example/encerramento.md'));

/**
 * Aqui eu configuro o domPdf da forma que eu precisar.
 * Você pode encapsular daqui pra frente em uma classe
 * para reutilizar rapidamente.
 */
$dompdf = new Dompdf\Dompdf;
$dompdf->setPaper('A4', 'portrait');
$dompdf->set_option('defaultFont', 'Helvetica');
$dompdf->set_option('dpi', 120);

/**
 * Ccomeço a gerar o pdf injetando o livro que já montei
 * e também o dompdf
 */
//
$generate = new WebDevBr\Ebook\Generate($book, $dompdf);

//opcionalmente um pouco de css pra personalizar a capa
$css = '
    @page :first {
       margin: 0;
       padding: 0;
       border: none;
    }

    .container-cover-0 {
        background-color:#c0392b;
        height: 100%;
    }
';
$generate->setCss($css);

//opcionalmente altero o padrão da numeração de páginas do rodapé
$generate->setPageFooter('Página $current_page de $total_pages - www.webdevbr.com.br', 400);

/**
 * Finalmente crio o livro
 * Se o segundo parametro for true (padrão é false)
 * um arquivo html será gerado também.
 */
$generate->make('book.pdf', true);

Don't forget to create the files inside the example directory:

How to contribute

Create an issue, or see what's already created, comment whats you will do or take your doubts, fork the project and after you make the fixes, do a pull request.

Simple like that.


All versions of php-ebook-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0.0|^8.0.0
michelf/php-markdown Version ^1.5
dompdf/dompdf Version 2.0.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dilneiss/php-ebook-generator contains the following files

Loading the files please wait ....