Download the PHP package ac/servedown without Composer

On this page you can find all versions of the php package ac/servedown. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package servedown

Servedown

This is a simple little utility to aid in serving markdown content on the web. It provides code abstractions for directories of markdown files, each of which may optionally contain a YAML configuration header.

There are only three classes to be aware of: Repository, Directory and File. A File just encapsulates a file on disc, and allows you to interact with the data in the configuration header (if present) independently of the main content. The Directory acts as a configurable factory for File objects under some base path. It will take care of making sure that configuration defined in parent directories cascades down to files. A Repository is also a directory, but you can request arbitraty paths contained under it, and it will make sure that containing directories are loaded as needed in order to allow the configuration to properly cascade.

The library does not convert the file contents into actual markdown - use whichever tool you prefer for doing that.

Example Usage

Here is some basic example usage.

<?php

//define repo at root directory of content, with some global configuration
//that will filter down to all contained pages/directories
$repo = new AC\Servedown\Repository(__DIR__."/blog", array('base_url' => 'http://example.com/blog), array(
    'file_extensions' => array("md", "markdown", "textile", "txt"),
    'hide_prefixes' => array("_"),
    'config_cascade_whitelist' => array('published'),
    'allow_index' => true,
    'index_name' => 'index',
));

//get a specific file
$item = $repo->getPath("2012/01/example-page.md");

//or a directory
$dir = $repo->getItem('2012/01);
foreach ($dir as $item) {
    if ($item->isDirectory()) {
        //load other containing files or something
    }
}

//get breadcrumb info, ideally to be used in a template
$breadcrumbData = $repo->getBreadcrumbData($item);
foreach ($breadcrumbData as $item) {
    $content .= sprintf("<a href='%s'>%s</a>", $item['url'], $item['title']);
}

//get some optional metadata, can contain whatever values you want
//to keep track of on a per-file basis
$title = $item->get('title', "Default Page Title");

//use some markdown parser to parse the page contents
$html = $yourFavoriteMarkdownParser->parse($item);

If you are using the library to expose the content to the web, note that you will need to make the directory web-accesible if you want to images to work properly. Or, you can write more code, or implement custom server configs.

Repository Configuration

Each repository has various options that can alter how the repository behaves, and what it is allowed to do. These options and their values can be passed in the constructor for the repository.

Note that when requesting breadcrumb data for a contained item, the Repository will automatically look for a title config for each file. If not present, it will translate the filepath into a more human-readable format.

Directory Configuration

Directories can be configured as well. When a directory loads a containing directory, it's directory behaviors cascade down to child directories. These are the available options:

Example Content

Here a few examples of content and configuration.

Example Page

Each page can contain a header of metadata in YAML format. Here's an example markdown page with configuration.

`
# Hello World #

This is your typical markdown content.

Example Directory Override

You can also configure directories by specifying an index file. For example, this could be specified in an index.md, and all files contained in that, and contained directories, would return false from $page->get('published');. The directories don't need to specify any actual content, though you can if you wish.

`

Potential TODOs


All versions of servedown with dependencies

PHP Build Version
Package Version
Requires php Version >5.3.3
symfony/yaml Version >2.0, <2.3
symfony/finder Version >2.0, <2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ac/servedown contains the following files

Loading the files please wait ...