amadulhaque / laravel-1688-package
Alibaba 1688 API integration for Laravel
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/amadulhaque/laravel-1688-package
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
- illuminate/http: ^10.48|^11.0|^12.0
- illuminate/support: ^10.48|^11.0|^12.0
Requires (Dev)
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.6
- phpunit/phpunit: ^12.3
README
A complete Laravel package for 1688 Alibaba. This package provides a simple and expressive API for interacting with the 1688.com dropshipping API.
Installation
You can install the package via composer:
composer require amadulhaque/laravel-1688-package
Next, you must publish the configuration file:
php artisan vendor:publish --provider="Amadulhaque\Laravel1688\Alibaba1688ServiceProvider" --tag="alibaba1688-config"
This will create a config/alibaba1688.php file in your project.
Finally, add the following keys to your .env file:
ALIBABA_APP_KEY=your-app-key
ALIBABA_SECRET_KEY=your-secret-key
ALIBABA_ACCESS_TOKEN=your-access-token
Usage
You can use the Alibaba1688 facade to access the API methods.
Search Products
use Amadulhaque\Laravel1688\Facades\Alibaba1688; $products = Alibaba1688::products('iphone');
You can also provide additional parameters:
$products = Alibaba1688::products( keyword: 'iphone', currentPage: 1, pageSize: 20, priceStart: '100', priceEnd: '500', categoryId: 123 );
Search Products by Multiple Keywords
$products = Alibaba1688::productsByMultipleKeywords(['hot items', 'new items']);
Get Product Details
$productDetails = Alibaba1688::productDetails('product-id');
Search by Image
$imageBase64 = base64_encode(file_get_contents('path/to/your/image.jpg')); $products = Alibaba1688::productImageSearch($imageBase64);
Get Recommended Products
$recommendedProducts = Alibaba1688::recommendProducts('product-id');
Get Categories
$categories = Alibaba1688::categories();
Check Connection
You can check the connection to the API:
$response = Alibaba1688::checkConnect();
Testing the Package
This document provides instructions on how to set up the environment and run the tests for this package.
Setup
-
Clone the repository:
git clone https://github.com/AmadulHaque/1688-laravel.git cd 1688-laravel-package -
Install dependencies: Make sure you have Composer installed. Then, run the following command to install the required dependencies, including the development dependencies:
composer install
The main development dependencies for testing are:
phpunit/phpunitorchestra/testbenchnunomaduro/collision
Running Tests
You can run the tests using the following Composer scripts defined in composer.json:
-
Run the test suite: This command executes the entire test suite.
composer test -
Run the test suite with testdox format: This command runs the tests and displays the output in a "testdox" format, which is more readable.
composer testdox
Contributing
Contributions are welcome! Please feel free to submit a pull request.
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin feature/your-feature). - Create a new Pull Request.
- 1688 Api
License
The MIT License (MIT). Please see License File for more information.