PHPackages                             magium/mcm-twitter - 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. magium/mcm-twitter

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

magium/mcm-twitter
==================

This is a simple library that manages the configuration for the abraham/twitteroauth library using the Magium Configuration Manager

0.9(8y ago)028Apache-2.0PHP

Since Aug 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/magium/mcm-twitter)[ Packagist](https://packagist.org/packages/magium/mcm-twitter)[ RSS](/packages/magium-mcm-twitter/feed)WikiDiscussions develop Synced yesterday

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

Magium Configuration Manager Adapter for abraham/twitteroauth
=============================================================

[](#magium-configuration-manager-adapter-for-abrahamtwitteroauth)

This library provides an interface for the abraham/twitteroauth so you can use it with the [Magium Configuration Manager](https://magiumlib.com/components/configuration). Often applications will have some kind of static configuration mechanism, such as XML files, JSON files, YAML files, or PHP files. There's nothing necessarily wrong with that, but what it does is merge your deployment and configuration concerns. The Magium Configuration Manager (MCM) breaks that dependency so you can manage configuration separately from your deployment.

This library uses the MCM to provide a configured abraham/twitteroauth instance.

Getting Started
---------------

[](#getting-started)

```
composer require magium/mcm-twitter

```

Configuring the MCM
-------------------

[](#configuring-the-mcm)

### Initialization

[](#initialization)

If you have not done so already, initialize the MCM.

```
$ vendor/bin/magium-configuration

Could not find a magium-configuration.xml file.  Where would you like me to put it?
  [0] C:\Projects\magium-configuration.xml
  [1] C:\Projects\mcm-twitter\magium-configuration.xml
 > 1
Wrote XML configuration file to: C:\Projects\mcm-twitter\magium-configuration.xml
The context file C:\Projects\mcm-twitter\contexts.xml does not exist next to the magium-configuration.xml file.  Create it? y

```

Then configure the magium-configuration.xml file. It will look something like this:

```

        pdo_sqlite
        /tmp/twitter

        filesystem

            /tmp

```

Then, make sure that the remote configuration table is created

```
vendor/bin/magium-configuration  magium:configuration:create-table

```

Setting the Configuration
-------------------------

[](#setting-the-configuration)

First list the configuration keys. These are the configuration endpoints that he library understands.

```
$ vendor/bin/magium-configuration magium:configuration:list-keys
Valid configuration keys
twitter/config/enabled (default: 1)
        (Set if the adapter is enabled.)

twitter/config/consumer_key
        (The consumer key from Twitter)

twitter/config/consumer_secret
        (The consumer secret from Twitter)

twitter/config/oauth_token
        (The Oauth token for the twitter account.  Only necessary if you are binding to a specific Twitter user)

twitter/config/oauth_token_secret
        (The Oauth token secret for the twitter account.  Only necessary if you are binding to a specific Twitter user)

```

Then create a custom Twitter application at . You will need the consumer key and consumer secret at a minimum. If you intend to interact with your account and not use it for authentication you can generate your access token and token secret from the application page.

Now you need to configure the MCM. (`magium-configuration` is in vendor/bin/ or `vendor/magium/configuration-manager/bin`)

```
$ magium-configuration magium:configuration:set twitter/config/consumer_key xxxxxxxxxxxxxxxx
Set twitter/config/consumer_key to xxxxxxxxxxxxxxxx (context: default)
Don't forget to rebuild your configuration cache with magium:configuration:build

$ magium-configuration magium:configuration:set twitter/config/consumer_secret xxxxxxxxxxxxxxxx
Set twitter/config/consumer_secret to xxxxxxxxxxxxxxxx (context: default)
Don't forget to rebuild your configuration cache with magium:configuration:build

$ magium-configuration magium:configuration:set twitter/config/oauth_token xxxxxxxxxxxxxxxx
Set twitter/config/oauth_token to xxxxxxxxxxxxxxxx (context: default)
Don't forget to rebuild your configuration cache with magium:configuration:build

$ magium-configuration magium:configuration:set twitter/config/oauth_token_secret xxxxxxxxxxxxxxxx
Set twitter/config/oauth_token_secret to xxxxxxxxxxxxxxxx (context: default)
Don't forget to rebuild your configuration cache with magium:configuration:build

```

Then you need to build the configuration to compile it and push it to the storage location.

```
$ magium-configuration magium:configuration:build

Building context: default
Building context: production

```

Usage
-----

[](#usage)

Using the MCM requires the use of the Magium Configuration Manager Factory which will receive the correct configuration object which you then pass to the Twitter Factory. That's a lot of words to explain this:

```
require_once __DIR__ . '/../vendor/autoload.php';

$magiumFactory = new \Magium\Configuration\MagiumConfigurationFactory();
$twitterFactory = new \Magium\ConfigurationManager\Twitter\TwitterFactory($magiumFactory->getConfiguration());

$twitter = $twitterFactory->factory();
$timeline = $twitter->get(
    \Magium\ConfigurationManager\Twitter\Constants::GET_STATUSES_USER_TIMELINE
);

foreach ($timeline as $tweet) {
    echo $tweet->text . "\n";
}

```

If you want to post an update:

```
require_once __DIR__ . '/../vendor/autoload.php';

$opts = getopt('', [
    'tweet::'
]);
if (!isset($opts['tweet']) || !$opts['tweet']) {
    echo "Please provide a tweet with --tweet\n";
    exit;
}

$magiumFactory = new \Magium\Configuration\MagiumConfigurationFactory();
$twitterFactory = new \Magium\ConfigurationManager\Twitter\TwitterFactory($magiumFactory->getConfiguration());

$twitter = $twitterFactory->factory();
$result = $twitter->post(
    \Magium\ConfigurationManager\Twitter\Constants::POST_STATUSES_UPDATE, ['status' => $opts['tweet']]
);

var_dump($result);

```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

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

3241d ago

### Community

Maintainers

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

---

Top Contributors

[![kschroeder](https://avatars.githubusercontent.com/u/237332?v=4)](https://github.com/kschroeder "kschroeder (3 commits)")

### Embed Badge

![Health badge](/badges/magium-mcm-twitter/health.svg)

```
[![Health](https://phpackages.com/badges/magium-mcm-twitter/health.svg)](https://phpackages.com/packages/magium-mcm-twitter)
```

###  Alternatives

[pdir/social-feed-bundle

Social feed extension for Contao CMS

1415.5k](/packages/pdir-social-feed-bundle)

PHPackages © 2026

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