/yourls-api-search-keywords

A plugin for YOURLS to search for keywords.

Primary LanguagePHP

yourls-api-search-keywords

This YOURLS plugin adds a new command to the YOURLS API: action=search_keywords

For a given keyword, it searches all keywords in the database and returns keywords that are similar to the given string. The API call requires a search_term parameter, and uses the LIKE %search_term% SQL expression to filter entries.

Example

Assume your database contains the following keywords (the URL is irrelevant):

keyword
myanimelist
myfavouriteanime
myfigurecollection
seasonalanime
jlptwordlist

The following API calls will respond with the corresponding keywords field values:

  • action=keyword_search&search_term=anime => ["myanimelist", "myfavouriteanime", "seasonalanime"]
  • action=keyword_search&search_term=my => ["myanimelist", "myfavouriteanime", "myfigurecollection"]
  • action=keyword_search&search_term=list => ["myanimelist", "jlptwordlist"]
  • action=keyword_search&search_term=manga => []

How to install this plugin

  1. Create a new directory under the "user/plugins" directory
  2. Save the "plugin.php" file into the directory you created in step 1
  3. Activate the plugin using your YOURLS admin panel

Credits

This repo is forked from:

It is a separate repo because I already have yourls-api-edit-url forked elsewhere.