# Symfony Package

[**SmartBotsBundle**](https://github.com/Kynno/SmartBotsBundle) is a Symfony bundle that provides a fast and convenient way to integrate the [SmartBots API](/doc/http-api-bholh6I5XU) into your PHP applications.

It allows you to **manage Second Life bots and groups** directly from your code — including sending IMs, inviting members, posting notices, translating group chats, and more.


:::tip
Created by **Luke Rowley**

:::


---

## Features

* Simple and lightweight integration of the [SmartBots HTTP API](https://www.mysmartbots.com/dev/docs/HTTP_API/Bot_Commands)
* Support for multiple bots with individual credentials
* Easy execution of bot and group commands from your Symfony services
* Works out of the box with minimal configuration


---

## Requirements

* PHP **7.1+**
* Symfony **3.4+ / 4.0+ / 5.0+**
* A **SmartBots Developer API Key** (available via your [SmartBots account](https://www.mysmartbots.com/))


---

## Installation

### With Symfony Flex

```bash
composer require kynno/smartbots-bundle
```

### Without Symfony Flex


1. Install the bundle:

```bash
composer require kynno/smartbots-bundle
```


2. Enable it in `config/bundles.php`:

```php
return [
    // ...
    Kynno\SmartBotsBundle\SmartBotsBundle::class => ['all' => true],
];
```


---

## Configuration

Add your API key and bot details to `config/packages/smartbots.yaml`:

```yaml
kynno_smartbots:
  api_key: "<your_api_key>"
  bots:
    Kynno:
      name: "KynnoSystem Resident"
      botSecret: "pwd"
    Leekyn:
      name: "Leekyn Resident"
      botSecret: "pwd"
```

**Options explained:**

* `api_key`: Your SmartBots developer API key
* `bots`: A list of bots you want to control
* Each bot entry includes:
  * `name`: The in-world bot’s full name
  * `botSecret`: The bot’s secret/password


:::info
You can define one or multiple bots. If no bot is explicitly chosen, the first configured bot will be used by default.

:::


---

## Usage

Inject the `SmartBots` service and start issuing commands:

```php
<?php

// Send an IM with the default bot
$this->smartBots->im('Heyter Nitely', "Hey, it's working!");

// Or target a specific bot
$this->smartBots->getBot('Leekyn')->im('Heyter Nitely', "Hey, it's working with a specific bot!");
```


---

## Commands

All supported commands — including instant messages, group invites, notices, and more — are listed in the official API documentation: 👉 [SmartBots HTTP API Commands](/doc/http-api-bholh6I5XU)

For examples of advanced usage, review the `AbstractSmartBotsCommands.php` class in the bundle source.