Download the PHP package noardcode/speech-to-text without Composer
On this page you can find all versions of the php package noardcode/speech-to-text. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download noardcode/speech-to-text
More information about noardcode/speech-to-text
Files in noardcode/speech-to-text
Package speech-to-text
Short Description This Laravel package provides a convenient interface for the Google Speech to Text API.
License MIT
Informations about the package speech-to-text
Laravel Google Speech to Text
This Laravel package provides a convenient interface for the Google Speech to Text API.
Prerequisites
- The gRPC packages is required when enabling the word time offsets option
- Step 1: Run
pecl install grpc
- Step 2: Add
extension=grpc.so
tophp.ini
grpc.dll
on windows
- Step 1: Run
Installation
Getting started
- Open Google Cloud Console and add the
Cloud Speech-to-Text API
toAPI's en services
in your project. - Create an Google Service Account with the following role: Cloud Speech Service Agent
- Make sure to generate a Service Account Key this file will be used for Authentication.
- Run
php artisan vendor:publish --provider="Noardcode\SpeechToText\SpeechToTextServiceProvider"
- This will create a
speech-to-text.php
file in yourconfig
folder.
- This will create a
- In
speech-to-text.php
change the following
For a detailed documentation about service accounts see: https://cloud.google.com/docs/authentication/production
Basic examples
Settings
You can change the default settings by publishing the config file and changing the following values.
Or change the settings when you have an instance of the class.
Audio types
By default the SpeechToText class will be passed the a GoogleCloudStorageAudio class. This class tells the SpeechToText class how to create the RecognitionAudio class from the Google Speech to Text Package. If you want to create the RecognitionAudio in in different way, e.g. a file from your local filesystem, you will need to set an other Audio class that implements the AudioInterface.
Side note: Google only supports sending inline files that are: less than 10MB in size and less than 1 minute in length
Transcripts
By default the SpeechToText class will be passed the a BasicTranscript class. This class tells the SpeechToText class how to handle the response from the SpeechClient class from the Google Speech to Text Package. If you want to handle the response from the SpeechClient in in different way, e.g. including the word time offsets, you will need to set an other Transcript class that implements the TranscriptInterface.
Example output of WordTimeOffsets transcript
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
Pull Requests
- PSR-2 Coding Standard - The easiest way to apply the conventions is to install PHP Code Sniffer.
- Document any change in behaviour - Make sure the
README.md
and any other relevant documentation are kept up-to-date. - Create feature branches - Don't ask us to pull from your master branch.
- One pull request per feature - If you want to do more than one thing, send multiple pull requests.
License
The MIT License (MIT). Please see License File for more information.
All versions of speech-to-text with dependencies
php Version ^7.2
google/cloud-speech Version dev-master