Download the PHP package oliverearl/nomiai-php without Composer
On this page you can find all versions of the php package oliverearl/nomiai-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oliverearl/nomiai-php
More information about oliverearl/nomiai-php
Files in oliverearl/nomiai-php
Package nomiai-php
Short Description PHP library for interacting with the Nomi.ai API
License MIT
Homepage https://github.com/oliverearl/nomiai-php
Informations about the package nomiai-php
Nomi.ai PHP Library
This is a lightweight, PHP library for interacting with the Nomi.ai REST API. Nomi AI is a companionship application that uses artificial intelligence.
The only prerequisite is at least PHP 8.3 with the JSON extension. You'll need a HTTP client too, preferably Guzzle. If you're using a popular framework, you should be good to go.
If you're using Laravel, install the Laravel-specific library instead.
Installation
You can install the package via Composer:
Usage
Quickstart
After installing the library, getting started is easy:
Retrieving Nomis
A numerically-indexed array of Nomis associated with an account can be returned using the library. If you know your Nomi's UUID, you can also retrieve their data individually.
Chatting with Nomis
Once you have a Nomi you want to chat with, or if you know their UUID, sending a message is easy. If all goes well, you
will end up with a MessageSet
object containing both your message and the corresponding reply.
Retrieving an avatar
You can retrieve the avatar from a Nomi with either a Nomi object, or their corresponding UUID.
Rooms
Retrieving rooms
You can retrieve a numerically-indexed array of rooms associated with your account. Just like with Nomis, if you know the UUID of the room, you can also retrieve this individually.
Creating a room for your Nomis
Creating a room for Nomis can be done with either an array of Nomi objects, or an array containing their respective
UUIDs. A RoomRequest
object exists to help you with this process, or you can use an associative array.
Updating and deleting rooms
Updating an existing room can also be done with a RoomRequest
object, or an associative array containing the values
you wish to change. Whatever you choose, it's a good idea not to include fields you don't want to update.
Deleting a room is straightforward. These methods will simply return true
as they will throw an appropriate
exception if something goes wrong.
Messaging within rooms
Sending a message into a room is easy. Be aware rooms do take time to initialise, so don't send a message to them immediately after creation. The message that was sent is returned as the result.
Nomis can be prompted to send a message to a room. For more information about this, please check the Nomi.ai website.
Functionality
The library is under active development. Complete feature availability is planned for the first major release.
Nomi.ai API Functionality | Implemented | Release |
---|---|---|
Retrieve and view Nomis | Yes | v0.1.2-alpha |
Send and receive messages to Nomis | Yes | v0.1.3-alpha |
Retrieve Nomi avatars | Yes | v0.1.6-alpha |
Retrieve rooms | Yes | v0.2.0-alpha |
Create rooms | Yes | v0.2.0-alpha |
Send messages into rooms | Yes | v0.2.0-alpha |
Delete rooms | Yes | v0.2.0-alpha |
For more information regarding the Nomi.ai API, please check the documentation available here.
Testing
Tests are run using the Pest testing framework. You can run the suite like so:
Code Style
Laravel Pint is used to maintain the PER coding style. The linter can be run using:
There are Pest architecture tests that also attempt to maintain certain conventions, including the use of strict typing where possible.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Your contributions are warmly welcomed! Anything from documentation, to optimisations, and additional tests. Pull requests must pass the existing test suite and conform to the required code style.
For new functionality, adequate tests must be included!
Credits
- Oliver Earl
- Nomi.ai
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of nomiai-php with dependencies
ext-json Version *