{"id":26280795,"url":"https://github.com/tattersoftware/reddit-bot","last_synced_at":"2026-03-17T17:33:16.975Z","repository":{"id":37008906,"uuid":"314833351","full_name":"tattersoftware/reddit-bot","owner":"tattersoftware","description":"Reddit bot in PHP CodeIgniter 4","archived":false,"fork":false,"pushed_at":"2023-02-20T12:14:32.000Z","size":438,"stargazers_count":3,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-06-12T19:07:38.476Z","etag":null,"topics":["codeigniter","codeigniter4","php","reddit","reddit-bot"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tattersoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-21T14:44:50.000Z","updated_at":"2022-05-26T17:06:00.000Z","dependencies_parsed_at":"2025-05-07T05:10:22.476Z","dependency_job_id":"e85fe0c8-5ca9-4a5c-80ce-723a9978bb3c","html_url":"https://github.com/tattersoftware/reddit-bot","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/tattersoftware/reddit-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Freddit-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Freddit-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Freddit-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Freddit-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tattersoftware","download_url":"https://codeload.github.com/tattersoftware/reddit-bot/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Freddit-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30628342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["codeigniter","codeigniter4","php","reddit","reddit-bot"],"created_at":"2025-03-14T15:17:51.884Z","updated_at":"2026-03-17T17:33:16.952Z","avatar_url":"https://github.com/tattersoftware.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reddit-bot\nReddit bot in PHP CodeIgniter 4\n\n[![](https://github.com/tattersoftware/reddit-bot/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/reddit-bot/actions/workflows/phpunit.yml)\n[![](https://github.com/tattersoftware/reddit-bot/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/reddit-bot/actions/workflows/phpstan.yml)\n[![](https://github.com/tattersoftware/reddit-bot/workflows/Deptrac/badge.svg)](https://github.com/tattersoftware/reddit-bot/actions/workflows/deptrac.yml)\n[![Coverage Status](https://coveralls.io/repos/github/tattersoftware/reddit-bot/badge.svg?branch=develop)](https://coveralls.io/github/tattersoftware/reddit-bot?branch=develop)\n\n## Description\n\n**RedditBot** provides PHP automation tools for Reddit, in CodeIgniter 4.\n\n## Requirements\n\n**RedditBot** is built on version 4 of the CodeIgniter PHP framework. You will need\nto be sure your environment meets all the\n[system requirements](https://codeigniter4.github.io/CodeIgniter4/intro/requirements.html).\nFramework requirements may change but here is a good start:\n\n* PHP 7.4 or newer\n* PHP extensions (`php -m`): intl, json, mbstring, mysqlnd, xml, curl\n* A database with one of the framework's supported drivers (default: SQLite3)\n\nFramework requirements may depend on your choice of web host. See \"Hosting with ...\"\nin the CodeIgniter [User Guide](https://codeigniter4.github.io/CodeIgniter4/installation/running.html).\n\nThese are additional requirements specific to this project:\n\n* [Composer](https://getcomposer.org/download/)\n* Access to credentials for Reddit\n\n## Installation\n\n1. Clone or download the repo\n2. Rename **env** to **.env** and fill credentials (*see below*)\n3. Install the framework, modules, and dependencies: `composer install`\n4. Migrate the database: `php spark migrate -all`\n5. Seed the database: `php spark db:seed InitialSeeder`\n\n## Credentials\n\nThe bot requires valid Reddit application credentials.\nFor more details read the [Reddit OAuth2 wiki](https://github.com/reddit-archive/reddit/wiki/OAuth2).\n\n1. Login to Reddit and visit the \"authorized applications\" page (https://www.reddit.com/prefs/apps/)\n2. Under \"developed applications\" select \"create an app...\"\n3. Select \"script\" as the application type\n4. Provide a name, description, and URLs in the required text fields\n5. Select \"create app\"\n\nOnce your application is created you will need to copy the \"client ID\" and \"secret\" (see the\nwiki article above for help). Add these along with your username and password into your\nproject's **.env** file, for example:\n```\n#--------------------------------------------------------------------\n# REDDIT API\n#--------------------------------------------------------------------\n\nreddit.clientId = as98-asdn3h93r\nreddit.clientSecret = LKhsa-ASJDn9a8sdion_laskdn0\nreddit.username = MyFiRsTrEdItTbOt\nreddit.password = ReallySecurePassword321\n```\n\nIf you want to use any of these optional extensions you will need to supply their\nconfiguration in **.env** as well:\n\n1. Email: Fill in the Email section with the specifics of your server's configuration\n2. Sentry.io (exception tracking): Fill `sentry.dsn` from the Sentry.io Project Settings (if you want to use exception reporting)\n3. Pushover: Fill `pushover.user` and `pushover.token` from the Pushover Client page for your desired device\n\n## Directives\n\n`Directives` are classes that direct the bot's interactions with Reddit. All `Directives` must be in a namespace's\n**Directives** subfolder and extend `App\\BaseDirective`. A `Directive` is configured by supplying its attributes:\n\n* `name`: A display-friendly name\n* `uid`: A Unique identifier\n* `subreddits`: An array of Subreddits to check\n* `patterns`: An array of regex patterns to match in Submission content\n* `actions`: An array of `BaseAction` classes (`EmailAction` and `PushAction` come by default)\n* `params`: Additional parameters to pass to each Action\n\nFor example, to get an email and push notification every time \"CodeIgniter\" is mentioned\non **r/PHP** you might use something like this:\n```\nprotected $attributes = [\n\t'name'       =\u003e 'CodeIgniter on r/PHP',\n\t'uid'        =\u003e 'ci_php',\n\t'subreddits' =\u003e ['PHP'],\n\t'patterns'   =\u003e ['/CodeIgniter/i'],\n\t'actions'    =\u003e [\n\t\t'App\\Actions\\EmailAction',\n\t\t'App\\Actions\\PushoverAction'],\n\t'params'     =\u003e [\n\t\t['recipients' =\u003e 'my.email.address@example.com'],\n\t\t['html' =\u003e 1],\n\t]\n];\n```\n\n## Usage\n\nMonitoring happens in three stages, each corresponding to its own command. Launch\nthe commands from the CLI using [CodeIgniter's \"spark\"](https://codeigniter4.github.io/CodeIgniter4/cli/cli_commands.html).\n\n* Fetch: Scans for Directives and fetches their Submissions (Links/Posts and Comments), storing them locally as flat files. `php spark reddit:fetch`\n* Filter: Filters stored submissions by the Directive regex patterns and loads them into the database. `php spark reddit:filter`\n* Execute: Iterates through matched Submissions and runs the Directive's Action (e.g. notifications or responses). `php spark reddit:execute`\n\n\u003e **Note**: The jobs are best run every minute by cron to get the latest results. They are intentionally split up to allow for job queue distribution.\n\n## Testing\n\nCopy **php.xml.dist** to **php.xml** and follow the same configuration steps above using the values from the various test environments.\nOnce the config file is complete you can run the tests:\n\n\tcomposer test\n\n### GitHub Actions\n\nThere is a unit test action configured to run on GitHub for every pull request to the `develop`\nbranch. There are necessary environment variables equivalent to those mentioned in the\n**Configuration** section above. These need to be supplied as **Secrets** on the GitHub\nrepo and then added to the **env** section in the [workflow definition YAML file](.github/workflows/test.yml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Freddit-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftattersoftware%2Freddit-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Freddit-bot/lists"}