PHPackages                             bestdefense-io/bd-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bestdefense-io/bd-sdk-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bestdefense-io/bd-sdk-php
=========================

BestDefense.io - PHP SDK

20PHP

Since Dec 2Pushed 1y agoCompare

[ Source](https://github.com/BestDefense-io/bd-sdk-php)[ Packagist](https://packagist.org/packages/bestdefense-io/bd-sdk-php)[ RSS](/packages/bestdefense-io-bd-sdk-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

BestDefense.io - PHP SDK Package
================================

[](#bestdefenseio---php-sdk-package)

Welcome to the **PHP SDK Package**! This SDK allows you to easily interact with **BestDefense.io Service API** within your Laravel or Symfony applications. It provides seamless integration and autowiring, requiring minimal setup so you can focus on building your application.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
    - [Laravel](#laravel)
    - [Symfony](#symfony)
- [Usage](#usage)
    - [Laravel Example](#laravel-example)
    - [Symfony Example](#symfony-example)
- [Methods](#methods)
- [Contributing](#contributing)
- [License](#license)

---

Installation
------------

[](#installation)

You can install the package via Composer. It's hosted on [Packagist](https://packagist.org/packages/bestdefense-io/bd-sdk-php) and can be included in your project by running:

```
composer require bestdefense-io/bd-sdk-php
```

---

Configuration
-------------

[](#configuration)

### Laravel

[](#laravel)

1. **Publish the Configuration File**

    After installing the package, publish the configuration file using Artisan:

    ```
    php artisan vendor:publish --provider="BestdefenseIo\BdSdkPhp\Providers\ApiServiceProvider" --tag="config"
    ```

    This command will publish a `bestdefense_sdk.php` configuration file to your application's `config` directory.
2. **Set Environment Variables**

    Add your API credentials to your `.env` file:

    ```
    BESTDEFENSE_API_TOKEN=your-api-token
    BESTDEFENSE_ACCOUNT_ID=your-account-id
    ```

    Alternatively, you can set these values directly in the `config/bestdefense_sdk.php` file.
3. **Caching Configuration (Optional)**

    If you cache your configuration, remember to refresh it after making changes:

    ```
    php artisan config:cache
    ```

### Symfony

[](#symfony)

1. **Register the Bundle**

    Add the bundle to your `config/bundles.php` file:

    ```
    return [
        // ...
        BestdefenseIo\BdSdkPhp\BdSDKBundle::class => ['all' => true],
    ];
    ```
2. **Configure Environment Variables**

    Add your API credentials to your `.env` file:

    ```
    BESTDEFENSE_API_TOKEN=your-api-token
    BESTDEFENSE_ACCOUNT_ID=your-account-id
    ```
3. **Import Services Configuration**

    Ensure that the package's services configuration is loaded by importing it in your `config/services.yaml`:

    ```
    # config/services.yaml
    imports:
        - { resource: '@BdSDKBundle/Resources/config/services.yaml' }
    ```

---

Usage
-----

[](#usage)

Once installed and configured, you can start using the SDK in your application.

### Laravel Example

[](#laravel-example)

```
