{"id":13803948,"url":"https://github.com/kevgk/Leya","last_synced_at":"2025-05-13T17:30:52.016Z","repository":{"id":9147813,"uuid":"10941071","full_name":"kevgk/Leya","owner":"kevgk","description":"Work with MySQL databases in autohotkey, without exposing server credentials.","archived":false,"fork":false,"pushed_at":"2020-04-30T18:02:57.000Z","size":107,"stargazers_count":16,"open_issues_count":3,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-04T01:03:00.103Z","etag":null,"topics":["ahk","api","autohotkey","database","improv3d","mysql","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevgk.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-25T14:44:14.000Z","updated_at":"2024-04-22T15:13:19.000Z","dependencies_parsed_at":"2022-08-30T10:32:03.212Z","dependency_job_id":null,"html_url":"https://github.com/kevgk/Leya","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevgk%2FLeya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevgk%2FLeya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevgk%2FLeya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevgk%2FLeya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevgk","download_url":"https://codeload.github.com/kevgk/Leya/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225247796,"owners_count":17444114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ahk","api","autohotkey","database","improv3d","mysql","php"],"created_at":"2024-08-04T01:00:39.403Z","updated_at":"2024-11-18T20:31:18.787Z","avatar_url":"https://github.com/kevgk.png","language":"PHP","funding_links":[],"categories":["Libraries"],"sub_categories":["Database"],"readme":"# Leya 3.0.0\n\n_Formerly \"Improv3d API\"_\n\n[![Gitter chat](https://badges.gitter.im/Improv3d-API.png)](https://gitter.im/Improv3d-API/Lobby)\n\n## About\n\nLeya is an api that enables the work with MySQL databases in autohotkey, without exposing server credentials to the client. This is done by running the api on a php server, between the client and the database.\n\nIn addition to that, you get a powerful authentification \u0026 permission system.\n\nYou don´t need to write any SQL queries, leya gives you a collection of commands to access and alter the database, and builds the queries for you.\n\n## Installation\n\n- Open `config.php`, fill in your server data and adjust permissions.\n- Upload the `leya.php` and `config.php` files.\n\n## Api Response\n\n### data\n\nThe api responds with an object containing your data and metadata. When requesting an array of rows, with methods like getWhere, the results are put into an array with the name of the database.\n\n### error\n\nWhen the \\_\\_error value is empty or 0, no error occurred, while executing the function.\n\n### affectedRows\n\nThe amount of rows, that got affected by the function.\n\n### example\n\nLet's say you executed the get method and requested \"username\" and \"role\".\nYour response is going to look like this:\n\n```\n{\n  data {\n    username\n    role\n  }\n  error\n  affectedRows\n}\n```\n\n```autohotkey\n#include leya.ahk\n\nleya.server := \"http://my-server.com/leya.php\"\n\nreq := leya.get(\"users\", \"playerA\", \"first_name, last_name\")\n\nplayer := req.data\n\nif req.error\n  msgbox % req.error\nelse\n  msgbox The fullname of playerA is %player.first_name% %player.last_name%.\n```\n\n```autohotkey\n#include leya.ahk\n\nleya.server := \"http://my-server.com/leya.php\"\n\nreq := leya.getWhere(\"users\", \"*\", \"age\", \"\u003e=\", \"18\")\n\nif req.error\n  msgbox % req.error\nelse {\n  msgbox Found %req.affectedRows% users over 18.\n  if req.users {\n    ; loop over all users, over the age of 18\n    for index, user in req.data.users {\n        msgbox % user.first_name \" \" user.last_name\n    }\n  }\n}\n```\n\n## Methods\n\n### Database\n\n#### Basic\n\n- [get(table, row, column)](https://github.com/kevgk/Leya/wiki/leya.get)\n- [getWhere(table, column, conditionColumn, operator, conditionValue)](https://github.com/kevgk/Leya/wiki/leya.getWhere)\n- [set(table, row, column, value)](https://github.com/kevgk/Leya/wiki/leya.set)\n- compare(table, row, column, value, caseInsensitive)\n\n#### Rows\n\n- createRow(table, row)\n- deleteRow(table, row)\n- listRows(table)\n- countRows(table)\n- rowExist(table, row)\n\n#### Columns\n\n- listColumns(table)\n- addColumn(table, column)\n- deleteColumn(table, column)\n- renameColumn(table, column, value)\n- setColumn(table, column, type, length)\n\n#### Table\n\n- createTable(table, columns)\n- deleteTable(table)\n- tableExist(table)\n- checkTable(table)\n- exec(query)\n\n### File\n\n- fileWrite(file, content, mode)\n- fileRead(file)\n- fileDelete(file)\n- fileRename(file, name)\n- fileExists(file)\n- fileCopy(file, destination)\n- fileSize(file, unit)\n\n### Misc\n\n- hash(content, algorithm)\n- mail(reciever, message, subject)\n- generateKey()\n- join(array, seperator)\n\n## Properties\n\n- leya.server\n- leya.key\n- leya.debug\n\n## Examples\n\n```autohotkey\n#include leya.ahk\n\nleya.server := \"http://my-server.com/leya.php\"\n\nplayer := leya.get(\"users\", \"playerA\", \"level\")\nmsgbox PlayerA is on Level %player.level%\n```\n\n```autohotkey\n#include leya.ahk\n\nleya.server := \"http://my-server.com/leya.php\"\n\n; get an array with the names of users, where \"level\" is greater than 3\npros := leya.getWhere(\"users\", \"name\", \"level\", \"\u003e\", 3)\n\n; turn the array into a comma seperated string\nlist := leya.join(pros, \", \")\n\nmsgbox %list% are over level 3.\n```\n\n```autohotkey\n#include leya.ahk\n\nleya.server := \"http://my-server.com/leya.php\"\n\nplayer := leya.get(\"users\", \"improv3d\", \"*\")\n\nmsgbox % \"Name: \" player.name \" Level: \" player.level\n```\n\n## Security\n\nIf you share your application with others, they could figure out the url to your server and use the api against you. Depending on your configuration, they could read anything from the database, modify data or even delete all tables.\n\nDon´t worry, the api has functions, to prevent this.\n\nYou should always use [Authentication-Keys](https://github.com/kevgk/leya/wiki/Authentication-Keys), so someone without a key, can´t access the api. When you´re working with multiple users, assign individual keys for every user, so you could easily block someone, or limit their permissions.\n\nOnly give users the permissions they need.\n\nDon't hardcode keys in your application. Import them from a txt file or let users enter them.\n\n```autohotkey\nFileRead, userkey, %A_ScriptDir%/apikey\n\nleya.key := userkey\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevgk%2FLeya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevgk%2FLeya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevgk%2FLeya/lists"}