Download the PHP package iamproperty/print without Composer

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

Printer

Introduction

Printer provides a way to render PDFs using an API similar to Laravel's Mailable.

Installation

Writing Printables

All of a printable class' configuration is done in the build method. Within this method, you may call the methods view, and with to configure the view to be printed.

Configuring The View

Within a printable class' build method, you may use the view method to specify which template should be used when rendering the document's contents. Since each document typically uses a Blade template to render its contents, you have the full power and convenience of the Blade templating engine when building your document's HTML:

/**
 * Build the document.
 *
 * @return $this
 */
public function build()
{
    return $this->view('printed.orders.invoice');
}

View Data

Via Public Properties

Typically, you will want to pass some data to your view that you can utilize when rendering the document's HTML. There are two ways you may make data available to your view. First, any public property defined on your printable class will automatically be made available to the view. So, for example, you may pass data into your printable class' constructor and set that data to public properties defined on the class:

<?php

namespace App\Printed;

use App\Order;
use IAMProperty\Printer\Printable;

class OrderShipped extends Printable
{
    /**
     * The order instance.
     *
     * @var Order
     */
    public $order;

    /**
     * Create a new printable instance.
     *
     * @return void
     */
    public function __construct(Order $order)
    {
        $this->order = $order;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('printed.orders.shipped');
    }
}

Once the data has been set to a public property, it will automatically be available in your view, so you may access it like you would access any other data in your Blade templates:

<div>
    Price: {{ $order->price }}
</div>

Via The with Method:

If you would like to customize the format of your document's data before it is sent to the template, you may manually pass your data to the view via the with method. Typically, you will still pass data via the printable class' constructor; however, you should set this data to protected or private properties so the data is not automatically made available to the template. Then, when calling the with method, pass an array of data that you wish to make available to the template:

<?php

namespace App\Printed;

use App\Order;
use IAMProperty\Printer\Printable;

class OrderShipped extends Printable
{
    /**
     * The order instance.
     *
     * @var Order
     */
    protected $order;

    /**
     * Create a new printable instance.
     *
     * @return void
     */
    public function __construct(Order $order)
    {
        $this->order = $order;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('printed.orders.shipped')
                    ->with([
                        'orderName' => $this->order->name,
                        'orderPrice' => $this->order->price,
                    ]);
    }
}

Once the data has been passed to the with method, it will automatically be available in your view, so you may access it like you would access any other data in your Blade templates:

<div>
    Price: {{ $orderPrice }}
</div>

Rendering Printables

Sometimes you may wish to capture the HTML content of a printable without converting it to a PDF. To accomplish this, you may call the toHtml method of the printable. This method will return the evaluated contents of the printable as a string:

$invoice = App\Invoice::find(1);

return (new App\Printed\InvoicePaid($invoice))->toHtml();

Previewing Printables In The Browser

When designing a printable's template, it is convenient to quickly preview the rendered printable in your browser like a typical Blade template. For this reason, you may return any printable directly from a route Closure or controller. When a printable is returned, it will be rendered and displayed in the browser, allowing you to quickly preview its design without needing to open a separate PDF file:

Route::get('printable', function () {
    $invoice = App\Invoice::find(1);

    return new App\Printed\InvoicePaid($invoice);
});

It's also possible to use the Printer facade to render a printable's template, without rendering the document:

Route::get('printable', function () {
    $invoice = App\Invoice::find(1);

    return Printer::render(new App\Printed\InvoicePaid($invoice));
});

All versions of print with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
illuminate/container Version ^6.0
illuminate/http Version ^6.0
illuminate/log Version ^6.0
illuminate/support Version ^6.0
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 iamproperty/print contains the following files

Loading the files please wait ....