PHPackages                             ginger-tek/jerpy - 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. ginger-tek/jerpy

ActiveProject

ginger-tek/jerpy
================

Simple, extendable, flat-file PHP website

4.5.7(7mo ago)032ISCPHPPHP &gt;=8.2.0

Since Jan 22Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/ginger-tek/jerpy)[ Packagist](https://packagist.org/packages/ginger-tek/jerpy)[ Docs](https://github.com/ginger-tek/jerpy)[ RSS](/packages/ginger-tek-jerpy/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)DependenciesVersions (15)Used By (0)

jerpy

Simple - Extendable - Flat-file

---

Jerpy a simple, extendable, flat-file simple website system built for control and ease-of-use that is easy to install, customize, and maintain.

**NOTE: Jerpy isn't a traditional CMS and doesn't have a management interface or web portal (but there *could* be a [plugin](#plugins) for that...). Everything is managed directly via the files themselves.**

Getting Started
===============

[](#getting-started)

Composer
--------

[](#composer)

```
composer create-project ginger-tek/jerpy

```

Files &amp; Folders
===================

[](#files--folders)

- `config.php`
    ------------

    [](#configphp)

    Set the timezone override, selected layout, enabled global plugins, and page routes here.
- `layouts`
    ---------

    [](#layouts)

    Stores layout templates, each their own `.php` file. The default global theme is set in `config.php` via the `$layout` property. The value is just the file name with no extension.
- `assets`
    --------

    [](#assets)

    Organize your CSS, JavaScript, fonts, and images to use in your layouts and pages via absolute URI here
- `content`
    ---------

    [](#content)

    For all your embedded content files, such as Markdown text files, and is not URL-accessible.

Pages &amp; Routes
------------------

[](#pages--routes)

Routes are configured in an associative array of a route key and page value. The value can be either a string or an associative array. If a string, the value is rendered using the default template, and the string is expected to be the filename of a page in the pages folder. If an associative array, there must be at least a `page` key and value. Optionally, a `meta` key and value can be set to include metadata for the given route, as well as a `layout` key and value to override the default layout, or not use one at all.

Example routes config:

```
$routes = [
  '/' => [
    'page' => 'home.php',
    'meta' => [
      'title' => 'Welcome to my site!'
    ]
  ],
  '/about' => [
    'page' => 'about.php',
    'meta' => [
      'title' => 'About Us',
      'thumbnail' => '/assets/my_thumbnail.png'
    ],
    'layout' => 'layout_2'
  ],
  '/simple/page' => 'simple_page.php',
  '/page/without/layout' => [
    'page' => 'some_page.php',
    'layout' => false
  ]
]
```

When implementing metadata, use null coalescing syntax to avoid warnings when a route does't have that metadata property specified:

```

  ...

```

Templating
==========

[](#templating)

PHP's built-in templating is sufficient for most websites. As such, just use `include` and `require` as you would normally for templating your site, parsing content as needed (see [plugins](#plugins)).

Global Variables
================

[](#global-variables)

NameData TypeNote`$uri``object`Clean URI value`$params``array`Any metadata key/values specified for the matched route`$page``string`Path to the page file being rendered`$meta``array`Any metadata key/values specified for the matched route`$layout``array`Current layoutPlugins
=======

[](#plugins)

Plugins can be created to extend or add functionality to Jerpy. They do not require any specific framework nor follow any particular design pattern. The only requirement for plugins is that the entrypoint is a `.php` file with the same name as the plugin's folder. From there, you can use whatever preferred tools and package managers to create the plugin code, such as Composer.

```
🗀 plugins
  🗀 myPlugin  'admin' // only loaded when /admin* is requested
];
```

Plugin Example
--------------

[](#plugin-example)

Below is an example plugin for using Parsedown via a wrapper method:

**NOTE: When including/requiring files within a plugin, make sure to use the `__DIR__` global to ensure PHP looks *within* the plugin directory and not in the root directory of the site**

`plugins/md/md.php`

```
