PHPackages                             borah/knowledge-base-laravel - 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. [API Development](/categories/api)
4. /
5. borah/knowledge-base-laravel

ActiveLibrary[API Development](/categories/api)

borah/knowledge-base-laravel
============================

Laravel wrapper for the Knowledge-Base API

v0.8.0(1y ago)12.1k↓67.1%1[3 PRs](https://github.com/BorahLabs/Knowledge-Base-Laravel/pulls)MITPHPPHP ^8.1CI failing

Since Jan 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/BorahLabs/Knowledge-Base-Laravel)[ Packagist](https://packagist.org/packages/borah/knowledge-base-laravel)[ Docs](https://github.com/BorahLabs/knowledge-base-laravel)[ GitHub Sponsors](https://github.com/BorahLabs)[ RSS](/packages/borah-knowledge-base-laravel/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (12)Versions (24)Used By (0)

Laravel wrapper for the Knowledge-Base API
==========================================

[](#laravel-wrapper-for-the-knowledge-base-api)

This package is a Laravel wrapper for the [Knowledge Base API](https://github.com/BorahLabs/Knowledge-Base). It will create and maintain a Knowledge Base for all the configured Eloquent models.

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

[](#installation)

You can install the package via composer:

```
composer require borah/knowledge-base-laravel
```

You must publish the migrations:

```
php artisan vendor:publish --tag="knowledge-base-laravel-migrations"
```

After the migration has been published you can run them using `php artisan migrate`.

Also, if you want, you can publish the config file with:

```
php artisan vendor:publish --tag="knowledge-base-laravel-config"
```

This is the contents of the published config file:

```
return [
    'connection' => [
        'host' => env('KNOWLEDGE_BASE_HOST', 'http://localhost:8100'),
    ],
    'models' => [
        'knowledge_base_id' => \Borah\KnowledgeBase\Models\KnowledgeBaseId::class,
    ],
];
```

Requirements
------------

[](#requirements)

This package is a wrapper for [Knowledge Base API](https://github.com/BorahLabs/Knowledge-Base), so you need to have it running in order to use this package.

Usage
-----

[](#usage)

To use it, you need to add the `Borah\KnowledgeBase\Traits\HasKnowledgeBase` trait to the models you want to add to the Knowledge Base. Also, these models should implement the `Borah\KnowledgeBase\Contracts\Embeddable` interface.

For example:

```
