Download the PHP package petecoop/odt without Composer

On this page you can find all versions of the php package petecoop/odt. 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 odt

ODT

Use Open Document Text (.odt) files as templates in PHP/Laravel projects, rendering them with Blade syntax and outputting as ODT or PDF.

This allows you to create complex document templates in LibreOffice or OpenOffice, including loops and conditionals using Blade syntax, render them with dynamic data and convert into PDF.

Why

I've found that there are some things that just can't be done when generating PDF's with HTML or PDF libraries that word processors have solved. This is usually where dynamic content can flow over multiple pages, and you want to do things like repeat table headers, or have some items of text stay together, or other more complex layouts like anchoring a section to the bottom of the final page. This also allows non-developers to create and edit document templates in a familiar word processor rather than having to write HTML or code.

Installation

Usage

In Laravel

Access via the ODT facade:

Other PHP Projects

Call ODT::make() to create an instance:

Converting to PDF

Conversion can be done using either the soffice binary directly, or via a Gotenberg server. soffice is the default and is slower due to the overhead of starting the LibreOffice process for each conversion, but requires no additional setup (other than installing LibreOffice). Gotenberg is faster for multiple conversions as it keeps a LibreOffice process running in the background, but requires a Gotenberg server to be running.

Using soffice for conversion

The soffice binary is required to be installed for PDF conversion. This should be available if LibreOffice or OpenOffice is installed on the system.

To convert to PDF, use the pdf() method after rendering.

If soffice is not in the system PATH, you can specify the path to the binary using the officeBinary method:

Using Gotenberg for conversion

To use Gotenberg for PDF conversion, you need to have a Gotenberg server running. You can specify the Gotenberg server URL using the gotenberg method:

A HTTP Client is required to be installed, if outside of Laravel you can install the Guzzle client:

See a full list of clients if you'd like to use a different one.

Saving or Downloading

The resulting .odt or PDF file can be saved to disk or returned as a download response:

Templating

Some Blade directives are provided to help with common templating tasks in ODT files.

Image Embedding

Use the @image directive to embed base64 encoded images into your ODT templates. This directive accepts a base64 image string and optional maximum width and height parameters (in cm).

Table Rows

When in Libre/Open Office you can't wrap a @foreach around a table row - use @rowforeach, this can be done inside a table cell. The entire row will be repeated for each item.

All other cells in the row will have access to the $user variable.

@rowif can be used to conditionally include a table row based on an expression. This is useful if you want to display a row only when certain conditions are met.

Note: due to a limitation of matching nested parentheses, only one level of nested parentheses is supported in the @rowforeach(...) and @rowif(...) expressions. e.g. @rowforeach($users as $user) or @rowforeach($items->where('active', true) as $item) will work, but more complex expressions with multiple levels of parentheses will not.

If you need more control over what is before / after the row use @beforerow / @endbeforerow and @afterrow / @endafterrow. This example is the equivalent of the above but allows you to put any other directives before or after the row.


All versions of odt with dependencies

PHP Build Version
Package Version
Requires illuminate/view Version ^8.0|^9.0|^10.0|^11.0|^12.0
nelexa/zip Version ^4.0
symfony/css-selector Version ^5.2|^6.0|^7.0
symfony/dom-crawler Version ^5.2|^6.0|^7.0
symfony/http-foundation Version ^7.3
symfony/process Version ^5.2|^6.0|^7.0
gotenberg/gotenberg-php Version ^2.14
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 petecoop/odt contains the following files

Loading the files please wait ...