- How do I install kodepintar/laravel-rajaongkir in a Laravel app?
- Install it with Composer by running composer require kodepintar/laravel-rajaongkir. Laravel's package auto-discovery should register the service provider and facade, so manual registration is normally not required. After installing, publish the package config file with the vendor publish command and add your RajaOngkir API key to your .env file. Pin at least version 3.0.4 in composer.json and commit your lockfile.
- Which Laravel and PHP versions does laravel-rajaongkir support?
- The package is a Laravel wrapper, but its exact Laravel and PHP constraints are defined in its composer.json, which you should read before adopting. Do not assume support for older or newer Laravel majors; verify against the versions your application actually runs. Check for PHP 8.3 and 8.4 deprecation warnings and Guzzle major version pins during your install. Test in a throwaway app first if you are on a recent Laravel release.
- Where do I put my RajaOngkir API key for this package?
- After publishing the config file, add your RajaOngkir API key to your .env file and reference it from the package config rather than hardcoding it. Keep the key out of version control and use separate keys for local, staging, and production. RajaOngkir plan tiers use different endpoints, so confirm which key type the package expects. If the package config schema collides with existing keys, rename or namespace them.
- How do I calculate shipping cost (ongkir) between two cities with laravel-rajaongkir?
- Use the package's cost or rate lookup, passing origin and destination IDs plus weight and courier code, mirroring the RajaOngkir cost endpoint. The exact method names come from the package README, which was not included in this evaluation, so confirm them against the source. Always send weight in grams and validate the courier code, because RajaOngkir rejects mismatched values. Treat the returned price as an estimate and re-verify it when the order is created.
- How do I get the list of provinces, cities, and subdistricts with this package?
- The package wraps RajaOngkir location endpoints, so you can fetch provinces, then cities by province ID, and subdistricts by city ID. Cache these lists aggressively, since they change rarely and the API is rate-limited per plan. Store the returned IDs, because those are what the cost endpoint expects, not the human-readable names. Note that subdistrict-level lookups are only available on some RajaOngkir plans.
- What does the 3.0.4 fix for 'data tidak terkirim untuk method post' mean, and should I upgrade?
- The 3.0.4 release note describes POST request data not being sent, which means versions 3.0.0 through 3.0.3 may have silently dropped payloads. Because the failure is silent, your checkout could appear to succeed while shipping cost queries were effectively empty. Pin ^3.0.4 or later, commit the lockfile, and confirm the resolved version in CI with composer show. If you already ran an affected version in production, audit recent rate lookups.
- How can I test laravel-rajaongkir without calling the live RajaOngkir API?
- Ideally the package uses Laravel's Http facade or an injectable Guzzle client, which lets you use Http::fake or a mock handler to assert the outbound request body. Confirm this before relying on it, because a package that builds its own transport internally is much harder to fake. Wrap the package behind an application-owned interface so your domain code is not coupled to it. Also add one sandbox integration test that checks a real POST payload arrives intact.
- Does laravel-rajaongkir work with RajaOngkir Starter, Pro, and Komerce API plans?
- RajaOngkir plan tiers use different base URLs and endpoints, and the package config may target only one of them. Check the published config for a base URL or plan setting and confirm it matches your subscription. This evaluation had no access to the package repository or docs, so verify against the source before committing. If your plan is not supported, call the API directly with Laravel's Http client.
- Is kodepintar/laravel-rajaongkir actively maintained, and what are the alternatives?
- Maintenance status, release cadence, license, and bus factor were not verifiable in this evaluation, so treat them as open questions before adopting. Check the repository's commit history, open issues, and last release date, and confirm who maintains it. Alternatives include other RajaOngkir wrappers or calling the REST API directly through Laravel's Http facade, which removes a wrapper dependency entirely. If you do adopt it, wrap it behind your own interface so it can be swapped out.
- Can I use laravel-rajaongkir in production for checkout shipping calculations?
- It is architecturally a thin infrastructure dependency, which is a reasonable fit for checkout rate lookups, but validate it against your real Laravel and PHP matrix first. Pin ^3.0.4 at minimum, keep the API key in .env, cache location data, and handle API timeouts with a fallback shipping option. Because a prior 3.x release silently dropped POST bodies, add a contract test asserting the request payload. Also confirm the package does not pin an incompatible Guzzle version.