2
Modules
Matthijs Iriks edited this page 2026-12-04 05:44:01 +01:00

Modules

The table says what is on by default. A module that is off has no routes, no tables (its migrations are not loaded), no menu item and no permissions.

Key What Default
users Accounts, groups and permissions on
media Media library on
pages Page texts on
posts Posts on
reviews Reviews off
audit Audit log and address bans off
resources Lists defined in config on
revisions History of posts and pages on
statistics Visitor statistics off

Switch a part in config/manager.php (modules) or with MANAGER_PAGES, MANAGER_POSTS, MANAGER_REVIEWS, MANAGER_AUDIT, MANAGER_STATISTICS. A module that is off has no routes, no tables, no menu item and no permissions: its migrations are not loaded at all. A module that needs another one (requires()) fails at boot when that one is off.

Users

Accounts and groups. HasManagerAccess on the host User model gives it managerGroups(), managerPermissions(), hasManagerPermission(), managerOutranks() and managerMayGive(). Keep is_super_admin out of $fillable: nobody becomes a super admin through a form.

php artisan manager:create-user      # the only way to make a super admin
  • A group is a name plus permissions; a permission that needs another one (posts.publish needs posts.write) brings it along. Permissions of a module that is off are ignored.
  • Whoever manages accounts only touches accounts that need nothing more than their own rights, and only hands out groups that give nothing they lack themselves.
  • groups.manage is a gate for super admins only, not a permission of a group.
  • The package defines one gate per permission and no Gate::before: it never answers for the abilities of your own app.
  • The migration adds is_super_admin to your users table (the table of manager.user_model). It promotes nobody.

Media

Files live on a Laravel filesystem disk (manager.media.disk); each row remembers its own disk.

  • Manager (behind manager.middleware): GET /manager/media, /manager/media/items, POST, PUT /{id}, DELETE /{id}. Limits (total room, file size, extensions) are in manager.media.*.
  • Visitors: GET /media-files/{id}/{filename}/view, outside the manager, no session. ETag, byte ranges, nosniff, and only images, video and PDF are shown inline. Rate limiter media-files.
  • Where a file is used: other modules or your app register a source with app(IriksIT\Manager\Support\MediaUsage::class)->register(fn () => $texts). Posts and Pages do.
  • No SVG: it can carry scripts.

Posts

Posts written in Markdown, with drafts, scheduling, categories and tags.

  • Routes under /manager: posts (list, create, {id}/edit, {id}/preview, update, {id}/online, delete) and labels (categories and tags: make, rename, merge, remove). Rights: posts.view, write, publish, delete, labels.
  • Who may not publish only saves drafts, and cannot change or delete a post that is live or scheduled.
  • A post is a draft (published_at null), scheduled (in the future) or published. For your public pages: IriksIT\Manager\Models\Post::published(), toCard() and IriksIT\Manager\Support\Markdown::toHtml() (raw HTML is escaped, external links open in a new window). The package has no public post routes: the host decides what a visitor sees.
  • Categories offered in the form: manager.posts.categories, the ones in use, the ones made by hand and whatever your site adds with app(IriksIT\Manager\Modules\Posts\PostLabels::class)->suggestCategories(fn () => $titles).
  • Covers and bodies count as use of a media file.

History

Every save of a post or page keeps its state (newest 50, who and what changed); revisions.restore puts one back as a new save. Whether a post is on the site is not part of the history. Details in the README.

Audit

Off by default: it stores IP addresses and browser lines, so a site switches it on knowingly and says so in its privacy policy (MANAGER_AUDIT=true).

  • The log: logins, logouts and failed logins (from Laravel's own Login, Logout and Failed events, so it works with any login the host has), every change in the manager, every page that is opened (not twice within five minutes) and every refusal. Only the account, the address and the browser line are kept, and for an action the fields its module listed, never what was typed into a form. The log is read with audit.view.
  • Names: a module says what its routes are called in the log with actions() and views(); a test fails on a manager route without a name.
  • Bans (audit.manage): ban an address by hand, for a time or until lifted, or a whole group of addresses (notes put addresses in a group). After too many failed logins an address is banned by itself (the rules are set in the manager). A banned address gets a 403 (429 for an automatic ban) on every manager route. Put the manager.not-banned middleware on the login routes of your app too. A site that is locked out lifts the ban with php artisan manager:unban {ip}.
  • Behind a proxy: set up trusted proxies (or MANAGER_NEVER_BAN) before switching the module on. Without them every visitor shares one address, and one bad actor can lock the whole manager out. Failed logins on any guard count towards the automatic ban.
  • Whole-site bans: with MANAGER_AUDIT_WHOLE_SITE_BANS=true a ban can also keep an address off the whole app. That adds a global middleware that is answered from the cache.
  • Config (manager.audit): never_ban (MANAGER_NEVER_BAN, comma-separated: your own addresses), and max_keep_days (MANAGER_AUDIT_MAX_KEEP_DAYS, 90): the longest the log may be kept, which your privacy policy has to agree with. manager:audit-prune runs daily and deletes old lines and ended bans; notes stay until removed.

Statistics

Off by default (MANAGER_STATISTICS=true). The site's own visitor statistics, with no cookie and no stored IP address: a visitor is a code made of the address, the browser and a random key that is deleted after a day (manager:forget-visitor-keys, scheduled daily), so a code cannot be traced back afterwards. A browser that sends DNT or Sec-GPC is not counted.

  • The script: <x-manager::pulse /> once in the layout does the reporting below (no cookies, honours Do Not Track).
  • Reporting: the pages of your site POST to /pulse/view ({path, referrer, via, campaign}, answers {token}) and, when the visitor leaves, /pulse/leave ({token, seconds}). No session, rate limited (manager.statistics.per_minute).
  • Which pages count: only addresses you name, so nobody can fill the statistics with made-up ones: manager.statistics.pages, the posts under manager.statistics.posts_path (published ones only), and anything else through app(IriksIT\Manager\Modules\Statistics\CountedPages::class)->register(fn (string $path) => ...).
  • Programs: the pages served to search engines, crawlers and previews are counted per day, program and page (no address, no browser line), by a middleware the module adds to the web group (manager.statistics.count_bots).
  • The report (statistics.view): visitors, visits, page views, time, bounce rate, a comparison with another period, pages, posts, sources and channels, devices, heatmap, programs; GET /manager/statistics?range=30d and a CSV per sheet (/manager/statistics/export?sheet=days|pages|sources|bots).
  • Country only when manager.statistics.country_header names a header (Cloudflare: CF-IPCountry).