Download the PHP package cspray/blogisthenics without Composer

On this page you can find all versions of the php package cspray/blogisthenics. 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 blogisthenics

Blogisthenics

Are you looking for a static site generator with the following features:

Then this project isn't for you because Blogisthenics doesn't offer any of those things! And never will! What do we give you instead?

Usage Guide

Oh, shit. You're still here? In all honesty, you probably shouldn't use this software! There's just an ass-load of site generators out there and nearly all of them are going to be more supported than whatever this ball of crap turns into. The stuff I write below is mostly for my own benefit so when I come back here in 6 months I can figure out what the hell is going on.

Directory Structure

Blogisthenics follows a principle that there are reasonable defaults for your site configuration, but you can override any of the defaults to customize your installation. Your directory structure should resemble the following:

Content Overview

Content for your site gets lumped into three categories:

Static Assets

Static assets are any content in your site that should not be dynamically rendered, whatever is in the file gets copied over exactly, with the same path, when the site is built. Specifically the following functionalities are not supported by static assets.

Pages

Pages are .html, .md, and .php files that act as specific content for a path that will be added to your site. Pages are expected to be only partial HTML documents and must define a layout. If a layout is not explicitly defined in the Front Matter of a page we use the default layout from the site configuration.

Layouts

Layouts are .md and .php files that act as the outer chrome for pages. Layouts can be inserted into other layouts. The below example demonstrates a minimal layout, typically named something like main.html.php or default.html.php.

Note the call to $this->yield(), when in a layout this is required to output the content being injected. If you attempt to call $this->yield() from a non-layout piece of Content an exception will be thrown. Check out the "Templating" section below for more details on using Pages and Layouts.

Templating

Blogisthenics uses PHP itself as the templating engine. On top of that we add some functionality to allow the following features:

The majority of the functionality described in this section refers to the Cspray\Blogisthenics\Context object. This object is defined as $this in your templates. The simplest templates might look something like the following.:

When built, your site would include an index.html file that resembles the following:

Template Helpers

Sometimes what you want to do might be too advanced for a static front matter or would be easier to share across many pages and layouts if it was encapsulated in a method you could invoke inside a template. Using the TemplateHelperProvider you can add template helper methods easily and then get access to them in your templates.

To utilize template helpers you'll have to implement some PHP code. In addition to whatever your helper does you'll have to make sure it gets integrated with Blogisthenics. Fortunately, that's easy to do thanks to Annotated Container. This code should live somewhere in the src directory of your Blogisthenics site.

Inside your template you can now invoke $this->myHelper()!

Auto-Escaping

Since Content can be generated at runtime with Front Matter that could include data from external sources Blogisthenics takes the stance that all of your data should be escaped properly. Utilizing the laminas/escaper project we automatically escape all values originating from the Context object. Meaning, all of your front matter, method helpers, and loaded JSON data get automatically HTML escaped at the time of output. If you don't want the value from a helper method to be escaped automatically wrap it in the value object Cspray\Blogisthenics\SafeToNotEncode.

Future updates will add a template API for contextually aware escaping. In other words, you'll be able to implicitly and explicitly escape a piece of data with awareness of whether it is CSS data, or JS data, or HTML data.

Template Formatting

As already mentioned, we support the ability to create pages out of Markdown documents. Specifically, Blogisthenics uses GitHub Flavored Markdown provided by the league/commonmark package. After all, writing a blog in just HTML would start to get pretty old... blog articles are pretty good candidates for Markdown. Instead of baking Markdown support into Blogisthenics somewhere we expose an interface called Cspray\Blogisthenics\Formatter that provides an opportunity for a rendered template to have some additional formatting applied. The Cspray\Blogisthenics\GitHubFlavoredMarkdownFormatter is the implementation taking care of Markdown. You can implement your own Formatter instance if you find Blogisthenics minimalist approach too spartan for you. We'll be taking advantage of Annotated Container to easily integrate your Formatters into Blogisthenics. This code should live somewhere in the src directory of your Blogisthenics site.

Now any template you create that ends in my-type or my-type.php will be passed to MyCustomFormatter before the contents are written to disk.

Dynamic Content

Sometimes it isn't possible to create all the necessary content ahead of time in static files. You may need to have access to the content of the site or some other information that requires you to provide the Content at runtime. You can take care of this in Blogisthenics by implementing the Cspray\Blogisthenics\DynamicContentProvider interface. We'll be using Annotated Container to easily integrate your implementations. This code should live somewhere in the src directory of your Blogisthenics site.

Programmatic Data

Sometimes your blog or site might need to include some programmatically loaded data. Inside Blogisthenics this data gets stored in the Cspray\Blogisthenics\KeyValueStore. You can depend on this service in your own #[Service] and a mutable implementation will be injected. In Template contexts you can get access to an immutable store through the Context::kv() method, $this->kv() in your templates. You can load data into the KeyValueStore in 1 of 2 methods; statically or through programmatic calls.

Loading Static Files

In your data directory, by default /data in your site's root, all JSON files will be loaded and stored in the KeyValueStore. All data is namespaced with the name of the file and keys in the JSON object are accessible through dot-notation. For example, If you have the following JSON file stored in /data/foo.json you can make the below method calls in your template.

Loading Dynamic Data

Maybe you don't know ahead of time what data needs to be loaded. In those situations you should implement a Cspray\Blogisthenics\DataProvider instance. We'll be taking advantage of Annotated Container to easily integrate this instance. Somewhere in your /src directory you should implement the following:

Just like statically loaded files you can access whatever data you load into the store through dot-notation. Unlike statically loaded files nothing is autonamespaced. If your data needs require a namespace you should make sure you do that in the keys you use to set data.

Why?!

Holy shit, cspray! Have you never heard of Jekyll, or Hugo, or any of the 134 bajillion generators listed on the JAMStack site?

Well, clearly I know about them. I included links to their sites! There's 4 primary reasons I did this.

  1. I'm a masochist.
  2. When I look at site generators out there I see a lot of libraries with, from my perspective, the following drawbacks:

    • Aren't written in PHP
    • Create sites using SPA architectures
    • Require me to use Laravel or Symfony

    I want to use PHP to build my site, and without requiring Laravel or Symfony to do so. I didn't find anything targeted towards the framework-less audience, so I built it myself.

  3. Opportunity to dogfood Annotated Container.
  4. Creating things to learn how they work or how I might accomplish it is how I learn things. It is kinda my jam.

All versions of blogisthenics with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laminas/laminas-escaper Version ^2.10.0
league/commonmark Version ^2.3
minicli/minicli Version ^3.2
minicli/command-help Version ^0.1.0
voku/stringy Version ^6.5
adbario/php-dot-notation Version ^3.1
cspray/annotated-container Version ^1.2
rdlowrey/auryn Version ^1.4
monolog/monolog Version ^3.1
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 cspray/blogisthenics contains the following files

Loading the files please wait ....