PHPackages                             heidilabs/markov-bot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. heidilabs/markov-bot

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

heidilabs/markov-bot
====================

A twitter bot using markov-php

0.1(11y ago)10762[1 issues](https://github.com/heidilabs/markov-bot/issues)MITPHP

Since Mar 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/heidilabs/markov-bot)[ Packagist](https://packagist.org/packages/heidilabs/markov-bot)[ Docs](https://github.com/heidilabs/markov-bot)[ RSS](/packages/heidilabs-markov-bot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Markov Bot - Twitter
====================

[](#markov-bot---twitter)

An open source Twitter bot that uses markov chains to generate tweets. This is basically a simple CLI application written in PHP, using the Symfony console. You can run the commands manually or schedule your bot to tweet periodically by adding the tweet command to crontab.

Requirements
------------

[](#requirements)

- php5-cli (cli only, no web server needed) and php5-curl
- [Composer](https://getcomposer.org/)
- Twitter APP, and proper credentials for the user account in which the tweets will be posted. The easiest thing to do is to create the app using the same account where the tweets will be posted, so you can get the user tokens right away in the app settings page. For detailed instructions, check [this tutorial](http://twilex.readthedocs.org/en/latest/app_creation.html).

Quick Installation Instructions
-------------------------------

[](#quick-installation-instructions)

1. Run `composer create-project heidilabs/markov-bot myDirectory` to clone the app repository and install the dependencies
2. Create your config file by copying `config/config-sample.yml` to `config/config.yml`. Edit the file to set your options, including Twitter credentials.
3. It's ready to use. Run `php console.php` to see the available commands. To test your current configuration without tweeting it, run `php console.php markov:test` .

Commands
--------

[](#commands)

### twitter:test

[](#twittertest)

Test the current Twitter settings and outputs which user is connected and would have the updates posted to, according to the provided keys.

```
    $ php console.php twitter:test
```

### markov:test

[](#markovtest)

Test the current bot settings and outputs an example of tweet that would be posted using this settings.

```
    $ php console.php markov:test
```

### markov:tweet

[](#markovtweet)

Posts an update to Twitter using the current settings. The tweet is also outputted.

```
    $ php console.php markov:tweet
```

### cache:update

[](#cacheupdate)

Updates the cached samples for Twitter and RSS feeds.

```
    $ php console.php cache:update
```

Configuring the sources
-----------------------

[](#configuring-the-sources)

Currently there are 3 adapters: File, Twitter and RSS. The contents are cached in the first run, and you can run a command to update this cache if you want. It might be interesting to add it to crontab to update once a day, for instance.

### Methods

[](#methods)

- wordchain: this will generate a word chain based on the samples you provide. A wordchain basically groups the text into parts of 2 words and try to find, randomly, a complement for each link of the chain. This method works better when you have more content as sample.
- mixedsource: this method is funny because it mixes two different sources, trying to use a common point of intersection between two sentences.

### Sources

[](#sources)

Sources can come from a text file, a twitter account, or a RSS feed. The contents are cached locally in a simple txt file. You can update the samples anytime by running `php console.php cache:update`. The sources are defined using a prefix, followed by the path (in case of local file), url without protocol prefix(in case of RSS) or username (in case of Twitter sources).

- file://path/to/file.txt
- twitter://erikaheidi
- rss://feeds.gawker.com/gizmodo/full

Note: RSS with full content instead of only titles and descriptions work better.

### Examples

[](#examples)

Using wordchain based on text files

```
    markov.settings:
        method: wordchain
        sources:
            - file://data/nietzsche.txt
            - file://data/linux.txt
```

> as a charm, that one should be heartily ashamed. To lose the intuition as to the EXTENT to which a process belongs

Using mixedsource based on text files

```
    markov.settings:
        method: mixedsource
        sources:
            - file://data/nietzsche.txt
            - file://data/mj.txt
```

> riddles which the conflicting nature at the basis of the kid is not my son She says I am the

Using mixedsource based on 2 different twitter users

```
    markov.settings:
        method: mixedsource
        sources:
            - twitter://erikaheidi
            - twitter://digitalocean
```

> Oh yes. Packing has started! @digitalocean @phpbenelux what a day... setup: Dive into service discovery and learn how it works

Using mixedsource with twitter and text file

```
    markov.settings:
        method: mixedsource
        sources:
            - twitter://erikaheidi
            - file://data/mj.txt
```

> marvelous. well done @ChasingUX , well done. So excited to always think twice (do think twice.) She told my baby

Using mixedsource with twitter and rss feed

```
    markov.settings:
        method: mixedsource
        sources:
            - twitter://erikaheidi
            - rss://feeds.gawker.com/gizmodo/full
```

> magician show at #phpbnl15 closing. By the way: I have missed, and it's all on BitStream.... The changing color of

Managing multiple bots
----------------------

[](#managing-multiple-bots)

You can run multiple bots within the same installation, for that you just need to create other config files and place them inside your "config" folder. Then, when calling the **markov** commands, you should provide the `--config` option, passing the name of the file as parameter.

Example:

```
    $ php console.php twitter:test --config=other.yml
    $ php console.php twitter:tweet --config=other.yml
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4086d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/efad91e92c56f2a771b7dbabb064d25d65392a60751a19666626672bdca575a6?d=identicon)[erikaheidi](/maintainers/erikaheidi)

---

Top Contributors

[![erikaheidi](https://avatars.githubusercontent.com/u/293241?v=4)](https://github.com/erikaheidi "erikaheidi (1 commits)")

---

Tags

twitterbotmarkov

### Embed Badge

![Health badge](/badges/heidilabs-markov-bot/health.svg)

```
[![Health](https://phpackages.com/badges/heidilabs-markov-bot/health.svg)](https://phpackages.com/packages/heidilabs-markov-bot)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[altis/local-server

Local Server module for Altis

18208.4k2](/packages/altis-local-server)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
