PHPackages                             mile23/druplex - 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. [Framework](/categories/framework)
4. /
5. mile23/druplex

ActiveLibrary[Framework](/categories/framework)

mile23/druplex
==============

Graft a Silex onto Drupal 7

247PHP

Since Apr 10Pushed 10y ago2 watchersCompare

[ Source](https://github.com/paul-m/druplex)[ Packagist](https://packagist.org/packages/mile23/druplex)[ RSS](/packages/mile23-druplex/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/289e0a7c407d3e7b62aead3c535762a2b2f9de6e203e01820ef5425511ffbee7/68747470733a2f2f7472617669732d63692e6f72672f7061756c2d6d2f647275706c65782e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/paul-m/druplex)

Druplex
=======

[](#druplex)

By Paul Mitchum, aka Mile23

What?
-----

[](#what)

Druplex is a half-baked way to attach a Silex RESTful API implementation onto Drupal 7.

It acts more as a proof-of-concept and some sloppy code to guide others along the way.

How To Install?
---------------

[](#how-to-install)

1. Install Composer:
2. Go to the root directory of your Drupal 7 installation.
3. Type this: `composer require mile23/druplex @dev`
4. Replace the root-level `index.php` file with the one located in `vendor/mile23/druplex/index/druplex.index.php`. Rename it to `index.php`, of course.
5. Put some settings in your site's `settings.php` file. They should be in the `$druplex` global variable. If you don't set these, druplex will use defaults, some of which might not be secure. Settings existing now:

- `$druplex['debug']`
- `$druplex['api_prefix']`
- `$druplex['api_user']`
- `$druplex['api_password']`

6. Point your web browser to `http://example.com/api`. After logging in with the http authentication, you will see a Silex error. Success!
7. Try `http://example.com/api/user/1` and you'll see a bit of JSON representing user 1. Rock on.

The `api_user` and `api_password` settings are used in protecting the Silex paths behind http authentication. You can't turn this off in settings. Default values: paul password

Note that in order to add Druplex to your Pantheon-hosted site, you'll have to say `composer require mile23/druplex @dev --prefer-dist` since Pantheon (rightly) balks when you try to include git submodules.

RESTful API
-----------

[](#restful-api)

This API is normalized on JSON.

Currently, you can:

- Query for a user by user ID through GET
- Create a user through POST
- Update a user through PUT
- Query for a user by an attached field
- Generate a one-time login for a user

### `GET /api/user/{uid}`

[](#get-apiuseruid)

Gets a sanitized version of the user for the user ID. Included here mostly for completeness and testing.

Returns a resource with `uid` and `name`.

### `POST /api/user`

[](#post-apiuser)

Post a user resource to the Drupal site.

Requires `name`, `mail`.

If you try to send `pass` it will fail. A random password will be generated for the user. Never send passwords over the internet, OK? :-) See the user one-time login part of this API for a solution to changing the password.

POSTing a user can only add fields which are present in Drupal's user schema. That is, no attached fields.

### `PUT /api/user/{uid}`

[](#put-apiuseruid)

Change a user record.

You can change any field which is present in the Drupal user schema, other than `pass` or `name`.

You can change the value of any attached field, too. You must include `fieldname`, `fieldcolumn`, and `fieldvalue`. You can only change one field per PUT, and multivalue fields are unsupported.

### `GET /api/user/{fieldname}/{fieldcolumn}/{fieldvalue}`

[](#get-apiuserfieldnamefieldcolumnfieldvalue)

Query for a user with a given attached field value.

You must specify the field name, the field column, and the value. The field column is the field's schema column. Fields can have more than one column, so we specify which column. For `text` fields, the column is `value`.

Returns a sanitized user record, as with GET.

### `GET /api/user/uli/{uid}`

[](#get-apiuseruliuid)

Get a one-time login URL for the given user.

Note that 'uli' is the Drush command for returning a one-time login, and that's why the name is used here.

Returns a resource with two properties:

- `user` is the sanitized user object.
- `uli` is the one-time login URL.

Where are the tests, Mr. Testing Man?
-------------------------------------

[](#where-are-the-tests-mr-testing-man)

See TESTING.md for all the testing lowdown.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7114cbf293c268d132d118bdd5ba25ccc523c62968307de9662e7c9fca72e379?d=identicon)[paul-m](/maintainers/paul-m)

---

Top Contributors

[![paul-m](https://avatars.githubusercontent.com/u/360238?v=4)](https://github.com/paul-m "paul-m (67 commits)")

### Embed Badge

![Health badge](/badges/mile23-druplex/health.svg)

```
[![Health](https://phpackages.com/badges/mile23-druplex/health.svg)](https://phpackages.com/packages/mile23-druplex)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

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