Download the PHP package fatfingers23/replit-database-client without Composer
On this page you can find all versions of the php package fatfingers23/replit-database-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fatfingers23/replit-database-client
More information about fatfingers23/replit-database-client
Files in fatfingers23/replit-database-client
Package replit-database-client
Short Description A simple client for interacting with a replit database.
License MIT
Homepage https://github.com/fatfingers23/Replit-Database-Client
Informations about the package replit-database-client
Repl.it PHP Database Client
Simple Repl.it database client in PHP. Loosely based off of the replit/database-node.
Requirements
- PHP >= 8.0;
- Composer.
Installation
composer require fatfingers23/replit-database-client
Get started
Docs
Client
class DatabaseClient(String url?)
Ability to pass a custom url
Native Functions
set(string $key, array|string $value): void
Sets a key with a string value
Sets a key with an array value
get(string $key): array|string|null
Gets a key with a string value
Gets a key with an array value
delete(string $key): void
Deletes an entry in the database by its key
getPrefixKeys(string $prefix): array
- Returns an array of keys that start with the prefix
- If no prefix is given returns all the keys in the database
- Returns an empty array if it finds no keys
Extended Functions
getPrefix(string $prefix): ?array
- Returns an array of all the values to a prefix
- If no prefix is given returns the whole database
- Returns null if no prefixs are found
deleteByPrefix(string $prefix = '')
- Deletes a series of keys by their prefix
- Careful if no prefix is given, this function will delete the entire database
Tests
or can just click run if this is open in a Repl.it
Contributing
- Fork it.
- Create your feature branch (git checkout -b my-new-feature).
- Make your changes.
- Run the tests, adding new ones for your own code if necessary (phpunit).
- Commit your changes (git commit -am 'Added some feature').
- Push to the branch (git push origin my-new-feature).
- Create new pull request.