Download the PHP package ahmadmayahi/php-google-vision without Composer

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

PHP Google Vision
[![Latest Version on Packagist](https://img.shields.io/packagist/v/ahmadmayahi/php-google-vision.svg)](https://packagist.org/packages/ahmadmayahi/php-google-vision) [![Total Downloads](https://img.shields.io/packagist/dt/ahmadmayahi/php-google-vision.svg)](https://packagist.org/packages/ahmadmayahi/php-google-vision) [![Tests](https://github.com/ahmadmayahi/php-google-vision/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ahmadmayahi/php-google-vision/actions/workflows/run-tests.yml) [![Check & fix styling](https://github.com/ahmadmayahi/php-google-vision/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/ahmadmayahi/php-google-vision/actions/workflows/php-cs-fixer.yml)
[![Test Coverage](https://codecov.io/gh/ahmadmayahi/php-google-vision/branch/main/graph/badge.svg?token=hayMyn8tLI)](https://codecov.io/gh/ahmadmayahi/php-google-vision) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ahmadmayahi/php-google-vision/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/ahmadmayahi/php-google-vision/?branch=main) [![Code Intelligence Status](https://scrutinizer-ci.com/g/ahmadmayahi/php-google-vision/badges/code-intelligence.svg?b=main)](https://scrutinizer-ci.com/code-intelligence)

Requires PHP 8.0+

For feedback, please contact me.

This package provides an elegant wrapper around Google Vision API and more.

It's an effort to make Google Vision API easy and fun to work with.

Contents

Installation

You may install the package via composer:

Creating Google Service Account

First, you must create a Google service account and setup the configuration object.

Configuration

Original Responses

All the features come with getOriginalResponse() method which returns the original response that's returned by PHP Google Vision Package:

The file() method accepts the following types:

Integration with Laravel

Open up the AppServiceProvider and add the following lines:

Using Dependency Injection:

You may also resolve the object using the app helper as follows:

Image Text Detection (OCR)

Get plain text

The plain() method returns an object of type AhmadMayahi\Vision\Data\ImageText.

Both plain() and document() methods return null if no text will be detected.

You may also get the plain text using __toString() magic method:

Get Document

The getDocument returns an object of type AhmadMayahi\Vision\Data\ImageText.

The difference between plain() and docuemnt() is that the first one only retrieves the plain text (no bullets, signs, etc...), whereas the latter one tries to retrieve the entire document (including bullets, symbols, etc...).

Handwriting

The document method can also be used to detect handwriting in an image.

PDF and Tiff

Coming soon.

Crop Hints Detection

Crop Hints suggests vertices for a crop region on an image.

Detect Crop Hints

Draw box around hints

You may use the drawBoxAroundHints method as follows:

Crop Image

You may export the cropped image as follows:

Original Image:

Cropped Image:

Face Detection

Face Detection detects multiple faces within an image along with the associated key facial attributes such as emotional state or wearing headwear.

The detect method returns a Generator of AhmadMayahi\Vision\Data\Face:

The anger, surprise and joy etc... return likelihoods ratings which are expressed as six different values:

See Likelihood.

You may get the results as array:

Or as JSON:

asArray and asJson is supported in all the features that return Generator.

Draw box around faces

All the drawing methods return an object of type AhmadMayahi\Vision\Support\Image.

This feature doesn't support Google Storage yet.

Image Properties Detection

The Image Properties feature detects general attributes of the image, such as dominant color.

The detect method returns a Generator of AhmadMayahi\Vision\Data\ImageProperties:

Landmark Detection

Landmark Detection detects popular natural and human-made structures within an image.

Safe Search Detection

SafeSearch Detection detects explicit content such as adult content or violent content within an image.

The detect method returns an object of type AhmadMayahi\Vision\Data\SafeSearch:

Label Detection

Detect and extract information about entities in an image, across a broad group of categories.

The detect method returns an a Generator of labels:

Logo Detection

Detect and extract information about entities in an image, across a broad group of categories.

The detect method returns an Generator of logos:

Object Localizer

Object Localizer detects and extract multiple objects in an image with Object Localization.

Detect Objects

The detect method returns a Generator of AhmadMayahi\Vision\Data\LocalizedObjectData:

Draw Box Around Objects

You may draw box around objects using the drawBoxAroundObjects method:

The drawBoxAroundObjects() takes an optionalcallback as a second parameter:

This feature doesn't support Google Storage yet.

Draw Box Around Objects With Text

You may want to draw box around objects and include the object's text as well:

This feature doesn't support Google Storage yet.

Web Detection

Web Detection detects Web references to an image.

The detect method returns either an object of tupe AhmadMayahi\Vision\Data\WebData or null value.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of php-google-vision with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
google/cloud-vision Version ^1.5
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 ahmadmayahi/php-google-vision contains the following files

Loading the files please wait ....