https://github.com/davesweb/laravel-bricklink-api
Laravel specific implementation for the davesweb/bricklink-api package
https://github.com/davesweb/laravel-bricklink-api
Last synced: 6 months ago
JSON representation
Laravel specific implementation for the davesweb/bricklink-api package
- Host: GitHub
- URL: https://github.com/davesweb/laravel-bricklink-api
- Owner: davesweb
- License: mit
- Created: 2021-08-10T11:10:51.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-06T18:22:21.000Z (about 4 years ago)
- Last Synced: 2025-05-04T21:51:34.726Z (about 1 year ago)
- Language: PHP
- Size: 47.9 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Bricklink API
This package is a Laravel wrapper for the `davesweb/bricklink-api` package. It adds a config file for your Bricklink credentials, a service provider which registers everything correctly for dependency injection, and an autodiscover to the `davesweb/bricklink-api` package. Other functionality stays the same.
## Installation
Via composer:
`composer require davesweb/laravel-bricklink-api`
After installation, publish the config file with `php artisan vendor:publish --tag=bricklink-config`.
## Configuration
This package needs 4 new environment variables:
```
BRICKLINK_CONSUMER_KEY=
BRICKLINK_CONSUMER_SECRET=
BRICKLINK_TOKEN_VALUE=
BIRCKLINK_TOKEN_SECRET=
```
You can find the values for these in your Bricklink account.
## Usage
This package takes care of the configuration of the API connection, so you can inject or resolve the repository classes directly in your Laravel application.
Example 1: Inject category repository in your controller:
```php
index();
return view('categories.index', [
'categories' => $categories,
]);
}
}
```
Example 2: Inject a repository in your controller and use value objects and transformers:
```php
toObject($request->validated());
$newCoupon = $repository->store($coupon);
return redirect()->back()->with('success', 'Succesfully created the new coupon ' . $newCoupon->couponId . '.');
}
}
```
For the documentation on how to use the repositories and value objects please refer to the [davesweb/bricklink-api](https://github.com/davesweb/bricklink-api) package.