Installation Methods
Laravel MercadoPago can be installed in two ways depending on your project structure and package distribution strategy.- Local Path Repository
- Versioned Package
Use this method when the package lives within your repository or in a sibling directory. Ideal for monorepo setups or local development.
Option A: Local Path Repository
This is the most direct approach when the package exists within your project structure.Copy or clone the package
Place the package inside your Laravel project directory. A common convention is to use a
plugins/ or packages/ folder:Register the local repository
Add the path repository configuration to your project’s
composer.json:composer.json
The
symlink: true option creates a symbolic link instead of copying files, allowing you to edit the package code directly.Install the package
Run Composer to require the package:Composer will use the local path and install the package via symlink.
Option B: Versioned Package
If your project has access to the package from a Composer registry, private repository, or VCS source, installation is straightforward.With this method, you don’t need the
repositories section in your composer.json. Composer will resolve the package from your configured sources.Auto-Discovery
The package uses Laravel’s package auto-discovery feature. The service provider is automatically registered via theextra.laravel.providers key in the package’s composer.json:
composer.json
config/app.php.
Registered Services
Once installed, the following services are available for dependency injection:PaymentMethodServicePreferenceServicePaymentServiceRefundServiceCustomerServiceCardServiceWebhookServiceTestUserService
Verification
After installation, verify everything is working correctly:Check package discovery
fitodac/laravel-mercadopago.Troubleshooting
Routes not appearing
If routes aren’t registered after installation:Demo routes returning 404
Demo routes are only available when:MERCADOPAGO_ENABLE_DEMO_ROUTES=truein your.env- Your
APP_ENVislocalortesting
Next Steps
Configuration
Configure environment variables, publish the config file, and set up your Mercado Pago credentials.