Link Search Menu Expand Document

Standalone PHP Solid Server

PDS Interop Project stage: Development License Latest Version standard-readme compliant Maintained

Standalone Solid Server written in PHP by PDS Interop

Table of Contents

Background

The Solid specifications defines what makes a “Solid Server”. Parts of those specifications are still likely to change, but at the time of this writing, they define:

  • Authentication
  • Authorization (and access control)
  • Content representation
  • Identity
  • Profiles
  • Resource (reading and writing) API
  • Social Web App Protocols (Notifications, Friends Lists, Followers and Following)

Installation

To install the project, clone it from GitHub and install the PHP dependencies using Composer:

git clone git://github.com/pdsinterop/php-solid-server.git \
    && cd php-solid-server \
    && composer install --no-dev --prefer-dist

At this point, the application is ready to run.

Usage

The PHP Solid server can be run in several different ways.

The application can be run with a Docker image of your choice or on a local environment, using Apache, NginX, or PHP’s internal HTTP server. The latter is only advised in development.

For security reasons, the server expects to run on HTTPS (also known as HTTP+TLS).

To run insecure, set the environment variable ENVIRONMENT to develop. This will prohibit the application from running in production mode.

Docker images

When running with your own Docker image, make sure to mount the project folder to wherever the image expects it to be, e.g. /app or /var/www.

For instance:

export PORT=8080 &&        \
docker run                 \
   --env "PORT=${PORT}"    \
   --expose "${PORT}"      \
   --network host          \
   --rm                    \
   --volume "$PWD:/app"    \
   -it                     \
   php:7.1                 \
   php --docroot /app/web/ --server "localhost:${PORT}" /app/web/index.php

Or on Mac:

export PORT=8080 &&        \
docker run                 \
   --env "PORT=${PORT}"    \
   --expose "${PORT}"      \
   -p "${PORT}:${PORT}"    \
   --rm                    \
   --volume "$PWD:/app"    \
   -it                     \
   php:7.1                 \
   php --docroot /app/web/ --server "localhost:${PORT}" /app/web/index.php

Local environment

How to run this application in an Apache, NginX, or other popular HTTP servers falls outside the scope of this project.

For development purposes, the internal PHP HTTP server is explained below.

Built-in PHP HTTP server

For development purposes a Composer serve-dev command has been provided. This will run the application using PHP internal HTTP server.

To use it, run composer serve-dev in the project root.

!!! FOR SECURITY REASONS, DO NOT USE THIS METHOD IN PRODUCTION !!!

By default, the application is hosted on localhost port 8080. So if you visit http://localhost:8080/ with your browser, you should see “Hello, World!”.

Both the HOST and PORT can be configured before running the command by setting them in the environment, for instance:

HOST='solid.local' PORT=1234 composer serve-dev

This command can also be run through a docker container, for instance:

export PORT=8080 &&     \
docker run              \
   --env "PORT=${PORT}" \
   --expose "${PORT}"   \
   --network host       \
   --rm                 \
   --volume "$PWD:/app" \
   -it                  \
   composer:latest      \
   serve

Running solid/webid-provider-tests

Due to https://github.com/pdsinterop/php-solid-server/issues/8 you should run, in one terminal window:

HOST=127.0.0.1 composer serve-dev

and in another you run the webid-provider-test as:

SERVER_ROOT=http://localhost:8080 ./node_modules/.bin/jest test/surface/fetch-openid-config.test.ts

The current dev branch of php-solid-server should pass roughly 7 out of 17 tests.

Available Features

Based on the specifications, the following features are available:

  1. User
    • Authentication
    • Identity
    • Profiles
  2. Data storage
    • Content representation
    • Resource API
      • HTTP REST API
      • Websocket API
  3. Web Acces Control List
    • Authorization (and Access Control)
  4. Social web apps
    • Calendar
    • Contacts
    • Friends Lists (Followers, Following)
    • Notifications

The checkboxes show which features are available, and which ones are not.

Development

Project structure

This project is structured as follows:

  .
  ├── src           <- Source code
  ├── vendor        <- Third-party and vendor code
  ├── web           <- Web content
  ├── composer.json <- PHP package and dependency configuration
  └── README.md     <- You are now here

Contributing

Questions or feedback can be given by opening an issue on GitHub.

All PDS Interop projects are open source and community-friendly. Any contribution is welcome! For more details read the contribution guidelines.

All PDS Interop projects adhere to the Code Manifesto as its code-of-conduct. Contributors are expected to abide by its terms.

There is a list of all contributors on GitHub.

For a list of changes see the CHANGELOG or the GitHub releases page.

License

All code created by PDS Interop is licensed under the MIT License.


Copyright © 2020 PDS Interop. Distributed under a MIT license.