Download the PHP package byte5/doormat without Composer

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

Doormat

Site notices for Statamic: a message editors switch on in the control panel - a holiday closure, a changed phone number, a warning about delays - that visitors see when they open the website.

Documentation

Requirements

Installation

The last line publishes the control panel's script to public/vendor/doormat/build; run it again after every update (a site that commits its published assets commits that folder).

doormat:install writes the notices collection (content/collections/doormat_notices.yaml) and its blueprint (resources/blueprints/collections/doormat_notices/notice.yaml) into the folders the site configured for Statamic, with every site listed. Commit both files; an existing file is left alone unless --force is given. The notices are listed under Content > Collections, for whoever may view the collection (Statamic's collection permissions); the settings page is under Tools > Add-ons > Doormat.

Upgrading to 0.4

The type field is notice_type now, in the blueprint and in what the tag and the endpoint hand out - Statamic's entry list answers a column named type with the collection's title, so the Type column stayed empty. An update script renames the field in the installed blueprint and moves the stored values; Statamic runs it after composer update, or by hand with php please updates:run 0.3.0 --package=byte5/doormat. A site with its own frontend or published views reads notice_type instead of type.

The notices

An entry of the collection: an internal name (the same in every language), a heading, a short Bard text and an optional button per language; a type (info, success, warning, error), a publish date, an optional take-down date, a pinned toggle (one notice at most), a dismissible toggle and how often a closed notice returns (once per visitor, once per session, on every page) - one value for every language. A notice shows on the sites it has a published localization on. Byte5\Doormat\Notices::active($site) returns the live notices of a site, the pinned one first, then the newest.

Showing them

Two ways; a site picks one.

The tag, rendered on the server:

Put it right after <body>. It renders the view config('doormat.view') names: modal (a dialog for the notices a visitor may close, one at a time with a pager; bars for the rest) or notice (bars only). view="notice" and site="en" override per placement. As a pair it loops the notices for your own markup; {{ doormat_notices:script }} prints the script alone. The views carry the data attributes the script reads (data-doormat-*); publish them to restyle:

The script is written in TypeScript as framework-free composables - useDismissals(), useDialog(), useBars() in resources/ts - and shipped compiled in resources/dist/doormat.js, so a site needs no build. A site with a build of its own can import them from the package's source (vendor/byte5/doormat/resources/ts) for its own markup. The dialog opens with show(), under a consent banner's z-index (--doormat-z-index, 1000), never in the browser's top layer. The view inlines it with data-cookieconsent="ignore"; dismissals are kept in localStorage / sessionStorage as doormat:<id>:<version>, so an edited notice returns.

With static caching the tag's output sits in cached pages: the addon flushes the static cache when a notice is saved or deleted, and doormat:flush-due - scheduled every minute - when a publish or take-down time passes. The scheduler must run.

The endpoint, for a site whose own JavaScript shows the notices:

answers {"data": [...], "meta": {"view": "modal", "delay": 0, "preview": false}}, each notice with id, version, heading, notice_type, text (HTML), button_label, button_url, pinned, dismissible, frequency; the current site without the parameter, 404 for an unknown one, never cached. Keep the storage keys of the addon's script if you write your own, and see Live preview for the one parameter a site's script forwards.

Live preview

Live Preview on a notice shows it, unsaved changes included, on a page of the site as a visitor would see it - the settings page picks the page, else the homepage. The collection file doormat:install writes enables it; an installation from before 0.3 adds two keys to its collection file, and a site with its own frontend forwards the page's token. See Frontend.

In the control panel

Dashboard widget

A "Doormat" card, built on Statamic's own widget, listing, per language, the notices live right now - or "No Doormat notices active" when none is. It notes when the master switch is off, and shows only to users who may view the notices. Add it in config/statamic/cp.php:

'languages' => 'active' lists only the languages that have a live notice; the default, 'all', lists every language, with "No notices active" under those without one.

Configuration

collection (default doormat_notices) and view (modal or notice; the settings page's choice wins).

Translations

The blueprint's labels are English; translate them in the site's lang/<locale>.json like any other blueprint's. The visitor strings are doormat::notices.*; translate them in lang/vendor/doormat/<locale>/notices.php (php artisan vendor:publish --tag=doormat-translations).

Development

The tests run on Orchestra Testbench with the Stache, two sites and the addon's own blueprint. GitHub Actions runs them on PHP 8.2 to 8.5 with Laravel 12 and 13, plus Pint, Larastan and Rector, and the TypeScript (typecheck, Vitest, and a check that the committed build matches the source), for every push and pull request. Rector skips the console command attributes, which need Laravel 13.

Releases are made by release-please from the conventional commits on main: it keeps a release pull request with the changelog open; merging it tags the version Composer installs.

License

GPL-3.0-or-later, see LICENSE.


All versions of doormat with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
statamic/cms Version ^6.35
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 byte5/doormat contains the following files

Loading the files please wait ...