PHPackages                             alexallotment/laravel-google-cloud-print - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alexallotment/laravel-google-cloud-print

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alexallotment/laravel-google-cloud-print
========================================

Google Cloud Print Service Provider for Laravel 7

0.1.2(9y ago)010MITPHPPHP &gt;=5.6.0

Since Dec 30Pushed 5y agoCompare

[ Source](https://github.com/alexallotment/laravel-google-cloud-print)[ Packagist](https://packagist.org/packages/alexallotment/laravel-google-cloud-print)[ RSS](/packages/alexallotment-laravel-google-cloud-print/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Google Cloud Print service for Laravel 6
========================================

[](#google-cloud-print-service-for-laravel-6)

Install
-------

[](#install)

Via composer :

```
composer require gnurlan/laravel-google-cloud-print

```

Then add the service provider class to your Laravel `config/app.php` :

```
'providers' => [
    // ...
    Bnb\GoogleCloudPrint\LaravelServiceProvider::class,
    // ...
],

```

Also add the Facade alias if you intend to use it :

```
'aliases' => [
    // ...
    'GoogleCloudPrint' => Bnb\GoogleCloudPrint\Facades\GoogleCloudPrint::class,
    // ...
],

```

Configuration
-------------

[](#configuration)

Set the env parameter `GCP_CREDENTIALS_PATH` to the absolute path (or relative to the laravel application root) of the servie account JSON file downloaded from Google Console.

### Google service setup

[](#google-service-setup)

Create a service account key (IAM) with a `***@re-speedy-diagnostic.iam.gserviceaccount.com`and download the JSON key file at . Copy the file into the project at the configured env path.

You also need to allow print access to the generated email address on all the desired printers via the Google Cloud Print console at .

This library will attempt to accept the invite if the Google API rejects the credentials. Indeed Google service accounts do not get the invitation email with the accept link and therefore need to use the API to complete the process.

Usage
-----

[](#usage)

### Create a print task

[](#create-a-print-task)

Either use the Facade or the shortcut with one of the three provided content type to get a print task object :

```
$task = GoogleCloudPrint::asText()
$task = GoogleCloudPrint::asHtml()
$task = GoogleCloudPrint::asPdf()

// or

$task = app('google.print')->asText()
$task = app('google.print')->asHtml()
$task = app('google.print')->asPdf()

```

#### Configure and send the print task

[](#configure-and-send-the-print-task)

Calling `->printer($printerId)` is required. The `$printerId` is the printer's UUID you get on the printer details page at Google Cloud Print console (or in the printer URL).

The content can be provided in three way :

- raw via `->content('A raw content')`.
- local file via `->file('/path/to/my/file')`. An exception is thrown if the file is not accessible
- url via `->url('http://acme.foo/bar')`. The content is downloaded locally before sending the print job. An exception is thrown if the URL does not begin with `http(s)://`

You can set any other Cloud Job Ticket option via the `->ticket($key, $value)` method. Some helpers are provided :

- range helper via `->range($start, $end)` (start and end pages are included).
- margins helpers via the `->marginsInMillimeters($top, $right, $bottom, $left)` and `->marginsInCentimeters($top, $right, $bottom, $left)`.

If the job is rejected an exception is thrown.

#### Examples

[](#examples)

```
$printerId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';

// Printing HTML from an URL
GoogleCloudPrint::asHtml()
    ->url('https://opensource.org/licenses/MIT')
    ->printer($printerId)
    ->send();

// Printing page 3 to 10 of a PDF from a local file
GoogleCloudPrint::asPdf()
    ->file('storage/document.pdf')
    ->range(3, 10)
    ->printer($printerId)
    ->send();

// Printing plain text with a 1cm margin on each sides using
GoogleCloudPrint::asText()
    ->content('This is a test')
    ->printer($printerId)
    ->marginsInCentimeters(1, 1, 1, 1)
    ->send();

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Total

2

Last Release

3418d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/45947182?v=4)[alexallotment](/maintainers/alexallotment)[@alexallotment](https://github.com/alexallotment)

---

Top Contributors

[![gabsource](https://avatars.githubusercontent.com/u/1851314?v=4)](https://github.com/gabsource "gabsource (8 commits)")[![alexallotment](https://avatars.githubusercontent.com/u/45947182?v=4)](https://github.com/alexallotment "alexallotment (6 commits)")[![djnet00](https://avatars.githubusercontent.com/u/1247442?v=4)](https://github.com/djnet00 "djnet00 (4 commits)")[![gnurlan](https://avatars.githubusercontent.com/u/3914007?v=4)](https://github.com/gnurlan "gnurlan (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alexallotment-laravel-google-cloud-print/health.svg)

```
[![Health](https://phpackages.com/badges/alexallotment-laravel-google-cloud-print/health.svg)](https://phpackages.com/packages/alexallotment-laravel-google-cloud-print)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
