- What does sharpapi/laravel-content-translate do?
- It is a Laravel package that adds AI-powered content translation to your application through the SharpAPI service. It provides a configurable API wrapper for translating text, articles, and structured content between languages. Instead of integrating directly with SharpAPI, you use the package's Laravel-friendly interface.
- How do I install sharpapi/laravel-content-translate?
- Install it with Composer using composer require sharpapi/laravel-content-translate. Laravel package auto-discovery should register the service provider and facade or bindings without manual edits. After installation, publish the package configuration if the package provides a config file and set your SharpAPI credentials.
- How do I configure the SharpAPI API key?
- Publish the package configuration file and add your SharpAPI API key to the .env file, typically under a package-specific environment variable name. Keep the key out of version control and never hard-code it in application code. If you cache configuration in production, run php artisan config:cache after updating the environment file.
- Which Laravel versions does this package support?
- The package is built for Laravel applications, but exact Laravel and PHP version constraints are defined in its composer.json. Check those constraints on Packagist or in the package metadata before installing. Because it uses standard Laravel package discovery, it should integrate without manual service provider registration on supported versions.
- Can I translate structured content such as arrays or JSON?
- Yes, the package is described as supporting structured content as well as plain text and articles. You pass the content to the translation wrapper and receive translated output from SharpAPI. Validate the response shape in your application before storing or rendering translated structured data.
- How do I translate an article or long text with this package?
- Use the package's translation method to send the article text to SharpAPI with the source and target languages. For very long content, consider splitting the text into smaller chunks or dispatching translation to a queued job. Store the returned translation and handle API errors or timeouts gracefully.
- Is sharpapi/laravel-content-translate suitable for production use?
- It can be used in production, but you should treat SharpAPI as an external dependency and handle failures explicitly. Queue large translation jobs instead of blocking web requests, add retries and timeouts, and cache translations where appropriate. Also review SharpAPI rate limits and error responses for your usage volume.
- How do I test translation code without calling the SharpAPI API?
- Mock the package's HTTP client or service binding in your Laravel tests instead of making real API calls. Laravel's HTTP fake helpers or dependency injection can return controlled translation responses. This keeps tests fast, deterministic, and independent of your SharpAPI account.
- What are alternatives to this package for translating Laravel content?
- Laravel's built-in localization is ideal for static UI strings but does not provide AI translation of dynamic articles. Alternatives include calling SharpAPI directly, using another translation API or SDK, or integrating a dedicated translation service. This package is useful when you specifically want a Laravel wrapper around SharpAPI content translation.
- Where can I find the repository and report issues for sharpapi/laravel-content-translate?
- The provided package metadata does not include a repository URL, so check the package page on Packagist for its source link and issue tracker. Review the package version history and README there before adopting it. If you find a bug, report it through the repository's issue tracker once confirmed.