Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Remove Bg Laravel Package

mtownsend/remove-bg

Remove backgrounds from images in PHP and Laravel with a simple wrapper around the remove.bg API. Pass a file path, URL, or binary image and get a transparent PNG back in one call, with clean error handling for size limits and failed requests.

View on GitHub
Deep Wiki
Context7

mtownsend/remove-bg is a Laravel package that wraps the remove.bg API, letting you strip backgrounds from images with a single, expressive call. Pass a local file path, a remote URL, or raw image content, and the package returns the processed image—ready to save, stream, or store—while handling API authentication, error responses, and result sizing for you.

  • Simple facade-style API for one-line background removal
  • Accepts file paths, URLs, and base64/raw image data
  • Configurable output size (preview, full, or auto)
  • Supports the remove.bg result type options and custom headers
  • Laravel configuration file plus publishable settings for API keys
Frequently asked questions about Remove Bg
How do I install mtownsend/remove-bg in Laravel?
Install it with Composer using composer require mtownsend/remove-bg. Laravel package auto-discovery registers the service provider and facade, so manual registration is usually unnecessary. Publish the config file if you need to set the remove.bg API key, and confirm the package's PHP and Laravel constraints match your runtime.
Does mtownsend/remove-bg support Laravel 10 and 11?
The package is a thin PHP client with a Laravel service provider, and the evaluation targets Laravel 9 through 11 on PHP 8.x. Its last release was in June 2023, so it may work on newer Laravel versions without formally declaring support. Check the composer.json constraints and run it in CI against your exact Laravel and PHP versions before relying on it.
How do I configure the remove.bg API key for mtownsend/remove-bg?
Publish the package config and set your remove.bg API key there, preferably via an environment variable so the key is not committed. The package reads that key when making requests to the remove.bg API. Keep the key in your secret manager and rotate it like any other third-party credential.
Can I remove a background from an image URL instead of a local file?
Yes. The wrapper accepts either a file path or an image URL, so you can pass a remote image directly to the remove.bg API. You can also set the output size and format options before making the call. The API returns a transparent PNG by default.
How do I save the removed-background PNG to Laravel storage?
The package returns the processed image data, which you can write to a Laravel disk using Storage::put or the filesystem API. The evaluation recommends storing outputs in your own object storage and returning signed URLs rather than serving them directly. That also keeps vendor responses out of your domain layer.
Does mtownsend/remove-bg work outside Laravel or in plain PHP?
It is effectively a plain PHP client with a Laravel service provider, so it can be used outside Laravel if you wire up the client manually. That gives you freedom to extract the image pipeline into a separate service later. Inside Laravel you get auto-discovery and a facade for convenience.
Should I call remove.bg synchronously in a controller or queue it?
Default usage is a synchronous external HTTP call, which makes remove.bg a latency and availability dependency in the request path. For production, move the call into a queued job with concurrency limits and store the result in your object storage. Instrument latency, error rate, and credit consumption, and add a circuit breaker.
How do I test mtownsend/remove-bg without calling the real remove.bg API?
Wrap the package behind your own interface such as a BackgroundRemoverContract and inject a fake implementation in tests. That keeps your domain code independent of the vendor and avoids per-image charges during CI. You can also use Laravel's HTTP fake to stub the underlying remove.bg API calls when testing the adapter itself.
What are the alternatives if mtownsend/remove-bg is abandoned?
The package is a thin wrapper around the remove.bg REST API, so you can replace it with a direct HTTP client, another Laravel wrapper, or a different background-removal vendor. The evaluation recommends defining your own contract and DTO from day one so swapping providers is a single adapter change. A self-hosted segmentation model is another longer-term option.
What are the production concerns with sending images to remove.bg?
Images may contain PII, customer content, or unreleased product imagery and are transmitted to a third party, so DPA, DPIA, and data-retention review may be required. Every call meters against a remove.bg account with its own quotas, pricing, and terms, which is unbudgeted business risk. Set a monthly cost ceiling, add observability around credit usage, and design a fallback adapter before going live.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core