sanmai / mercari-php-sdk
Mercari API PHP SDK
Installs: 4 427
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sanmai/mercari-php-sdk
Requires
- php: ^8.2
- ext-json: *
- caseyamcl/guzzle_retry_middleware: ^2.9
- doctrine/annotations: ^2.0
- guzzlehttp/guzzle: ^6.3 || ^7.0
- jms/serializer: ^3.29
- psr/log: ^1.1
- sanmai/duoclock: ^0.1.3
- sanmai/json-serializer: ^0.2.5
- symfony/http-foundation: ^4.4.7 || ^5.0.7 || ^7.0.0
Requires (Dev)
- ergebnis/composer-normalize: >=2.23
- fakerphp/faker: ^1.23
- friendsofphp/php-cs-fixer: ^3
- infection/infection: ^0.31
- jenssegers/optimus: ^0.2.3 || ^1.0.0
- php-coveralls/php-coveralls: ^2.4
- phpstan/phpstan: >=0.10
- phpunit/phpunit: ^9.3
- sanmai/pipeline: >=6.11
- symfony/validator: >=5.4
Suggests
- doctrine/cache: For metadata caching
- monolog/monolog: For advanced logging and debugging
This package is auto-updated.
Last update: 2026-02-02 10:41:54 UTC
README
This is a pretty complete Mercari API client. Feel free to jump in and contribute!
composer require sanmai/mercari-php-sdk
Status of Implementation
- Search Items (v3)
- Get Item By ID
- Get User By ID
- Fetch Bulk Items by ID
- Purchase Item
- Similar Items
- Get Transaction By TransactionID
- Get Transaction By ItemID
- Get Transaction Messages
- Post Transaction Messages
- Post Transaction Review
- Get Todo List
- Get Comments
- Post Comment
- Get Item Categories
- Get Item Brands
What You Need
Before you start messing with this API client, here's the lowdown on what you gotta have:
- Authority Hostname. In the examples, we'll pretend it's
proxy-auth.example.com. - "Open API" Hostname. This is where you actually talk to the Mercari API. We'll call it
proxy-api.example.com. - API Credentials: You'll need a
client_idandclient_secretfrom Mercari.
Next, you can either set up your own proxy server or resort to a dynamic SSH tunnel. Your call!
Proxy Server
Just add a new location block to your config file:
location / { proxy_pass https://actual-api-host.example.jp/; proxy_ssl_server_name on; # Lock it down with an IP allow list allow 192.168.1.0/24; # Allow a specific subnet allow 10.0.0.1; # Allow a specific IP deny all; # Deny all other IPs }
This tells nginx to forward requests to your actual-api-host.example.jp server, but only from the IPs you've specified. You're in control, deciding who gets access and what they can do.
SSH Tunnel
If you don't want to set up a dedicated proxy, fear not! Just run this command to set up a dynamic SSH tunnel:
ssh -fCND 1080 my-server.example.com
This opens a tunnel through your my-server.example.com server (replace with your actual server address), granting you access to the Mercari API as if you were right there on the server.
Development
To run all tests:
make -j -k