PHPackages                             bigpoint/slim-bootstrap - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. bigpoint/slim-bootstrap

Abandoned → [bigpoint/slim-bootstrap3](/?search=bigpoint%2Fslim-bootstrap3)ArchivedLibrary[HTTP &amp; Networking](/categories/http)

bigpoint/slim-bootstrap
=======================

These classes provide a simple way to bootstrap a Slim application with authentication.

1.8.0(10y ago)55281Apache-2.0PHPPHP &gt;=5.3.3

Since Jan 26Pushed 6y ago8 watchersCompare

[ Source](https://github.com/Bigpoint/slim-bootstrap)[ Packagist](https://packagist.org/packages/bigpoint/slim-bootstrap)[ Docs](https://github.com/Bigpoint/slim-bootstrap)[ RSS](/packages/bigpoint-slim-bootstrap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

Slim Bootstrap
==============

[](#slim-bootstrap)

**This framework is deprecated in favor of **.

These classes provide a simple way to bootstrap a Slim application with authentication.

It is an abstraction of the [Slim Framework](http://slimframework.com/) and handles some stuff like output generation in different formats and authentication / acl handling.

installation
------------

[](#installation)

```
composer require bigpoint/slim-bootstrap

```

webserver configuration
-----------------------

[](#webserver-configuration)

In order to configure your webserver to pass all requests in a proper way to the slim application please read the [Route URL Rewriting](http://docs.slimframework.com/#Route-URL-Rewriting) section of the Slim documentation.

Setup Skeleton API
------------------

[](#setup-skeleton-api)

Create a folder for your new api and run the following command there.

Set `` in the following one liner to your API namespace (camel case) name and execute this line. It will load the framework and create a skeleton structure:

```
NAMESPACE="" && composer init -n && composer require "bigpoint/slim-bootstrap:*" && ./vendor/bin/slim-bootstrap-generator "${NAMESPACE}" && composer dumpautoload

```

How to implement manually
-------------------------

[](#how-to-implement-manually)

In order to create a rest api based on this framework you need a structure similar to the following in your project.

```
├── composer.json
├── config
│   └── application.json
├── include
│   └── ###Namespace###
│       └── Endpoint
│           └── V1
│               ├── Collection
│               │   └── EndpointA.php
│               └── Resource
│                   └── EndpointA.php
└── www
    └── index.php

```

### config/application.json

[](#configapplicationjson)

This file holds the main configuration for the implementation and the framework. For documentation on the `"monolog"` block in the config see [MonologCreator](https://github.com/Bigpoint/monolog-creator).

The following structure has to be present:

```
    {
        "shortName": "###NAMESPACE_LOWER###",
        "cacheDuration": 900,
        "debug": false,
        "csv": {
            "delimiter": ",",
            "enclosure": "\"",
            "linebreak": "\r\n",
            "encloseAll": false,
            "null": "NULL"
        },
        "monolog": {
            "handler": {
                "udp": {
                    "host": "127.0.0.1",
                    "port": 6666,
                    "formatter": "logstash"
                }
            },
            "formatter": {
                "logstash": {
                    "type": "SlimBootstrap-###NAMESPACE_LOWER###"
                }
            },
            "logger": {
                "_default": {
                    "handler": ["udp"],
                    "level": "DEBUG"
                },
                "slim": {
                    "handler": ["udp"],
                    "level": "DEBUG"
                }
            }
        }
    }
```

The `shortName` is used to prefix the endpoint names in the welcome endpoint when hal+json is used as output format.

The `cacheDuration` defines the interval (in seconds) used for the cache expire headers of the response.

If the `debug` flag is set to true the slim framework will print out a stack trace if an error occurs. Otherwise it will just show a 500 Internal Server Error.

### the include/ folder

[](#the-include-folder)

This folder should contain your endpoint implementation. Read below about how to define an endpoint.

### the www/index.php

[](#the-wwwindexphp)

This file is the main entry point for the application. Here is an example how this file should look like:

```
