Download the PHP package tatter/themes without Composer

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

Tatter\Themes

Lightweight theme manager for CodeIgniter 4

Coverage Status

Quick Start

  1. Install with Composer: > composer require tatter/themes
  2. Update the database: > php spark migrate -all
  3. Seed the database: > php spark db:seed "Tatter\Themes\Database\Seeds\ThemeSeeder"
  4. Place theme files in public/assets/themes/default
  5. Add theme files to your page, e.g.: echo view('\Tatter\Themes\Views\css)

Features

Provides convenient theme file organization and display for CodeIgniter 4

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Once the files are downloaded and included in the autoload, run any library migrations to ensure the database is setup correctly:

You will also need to seed the database with a default theme:

Dependencies

Themes relies heavily on these libraries; be sure you are familiar with their own requirements and installation process.

If you plan on allowing users to change their own themes then you will also need to include an authentication library the provides codeigniter4/authentication-implementation (no other configuration necessary).

Read more about CodeIgniter Authentication in the User Guide.

Usage

This library assumes you already have the asset files (CSS and JavaScript) used by your themes.

Themes are managed via the database and configured for your application using Filters.

Managing Themes

Theme files all go into a directory relative to the config property $directory from Tatter\Assets (default is public/assets/), as defined by a theme's path. E.g.

Each theme is an entry in the database themes table with the following properties:

You may use the supplied model (Tatter\Themes\Models\ThemeModel) to create new themes or return entities (Tatter\Themes\Entities\Theme). The library comes with the ThemeSeeder which will create an initial "Default" theme for you at public/assets/themes/default/. There is also a themes:add Spark command to guide you through loading themes from CLI.

Selecting a Theme

The current theme is determined as follows:

  1. Is there an authenticated user? Check Preferences for that user's theme preference
  2. No authenticated user? Check the Session for a theme preference
  3. Neither of above? Check Settings for a stored persistent theme
  4. None of the above? Fall back on the config file: config('Preferences')->theme (default value "Default")

Likewise, you can set the current theme using the corresponding methods (in priority order):

  1. preference('theme', $themeName) (with authenticated user)
  2. preference('theme', $themeName) (without authenticated user)
  3. setting('Preferences.theme, $themeName)
  4. Create or edit app/Config/Preferences.php and add: public $theme = 'theme_name';

To assist with methods 1 & 2 this library comes with a tiny module to display a form and process user input. You can add the form to an existing page with the Form View:

...or add the preconfigured <select> field to an existing form:

You can pass these additional parameters to the view:

Applying Themes

Once your files are in place and your theme is defined in the database you need to apply the theme to your application routes using Filters. This library activates the ThemesFilter for you on installation (assuming module discovery is enabled, which is the default) under the alias themes. In simple cases you will want to apply the filter to your entire site via app/Config/Filters.php:

For more nuanced use, pass the filter to your route definitions in app/Config/Routes.php:

ThemesFilter will apply the current theme by default, but you may specify a theme or themes by name to use those instead:

Additional Components

CLI

The library comes with two CLI commands, themes:list and themes:add to ease working with themes in the database.

Helper

The Theme Helper is loaded automatically when you apply ThemeFilter, but should you need to load it manually include it your controllers or boot config: helper('themes').

This provides a helper function to return the current theme as a Theme entity:


All versions of themes with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ^8.0
tatter/assets Version ^3.0
tatter/preferences Version ^1.0
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 tatter/themes contains the following files

Loading the files please wait ....