Download the PHP package jeremykenedy/laravel-darkmode-toggle without Composer

On this page you can find all versions of the php package jeremykenedy/laravel-darkmode-toggle. 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 laravel-darkmode-toggle

A standalone dark mode toggle component for Laravel with Light, Dark, and System modes,
localStorage persistence, optional server-side sync, and full CSS/frontend framework parity.

Total Downloads Latest Stable Version Tests StyleCI License: MIT

## Table of Contents - [Framework Support](#framework-support) - [Requirements](#requirements) - [Installation](#installation) - [Quick Start](#quick-start) - [Features](#features) - [Configuration](#configuration) - [Server-Side Persistence](#server-side-persistence) - [Changing Frameworks](#changing-frameworks) - [Artisan Commands](#artisan-commands) - [How It Works](#how-it-works) - [Testing](#testing) - [License](#license) ## Framework Support Every CSS and frontend combination is fully supported with identical features: | | Blade + Alpine.js | Livewire 3 | Vue 3 | React 18 | Svelte 4 | | --------------- | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | | **Tailwind v4** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | **Bootstrap 5** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | **Bootstrap 4** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | **15 combinations. Zero feature gaps.** ## Requirements - PHP 8.2+ - Laravel 12 or 13 - One CSS framework: Tailwind v4, Bootstrap 5, or Bootstrap 4 - One frontend: Blade + Alpine.js, Livewire 3, Vue 3, React 18, or Svelte 4 ## Installation The interactive installer will prompt you to select your CSS and frontend frameworks. ### Non-Interactive Install > **Note:** If the package is already installed, the install command will warn you and recommend using `darkmode:update` instead. You can force a fresh reinstall with `--force`, but this will overwrite your config and published views. ## Quick Start ### 1. Add the init script to `` Prevents flash of wrong theme on page load: ### 2. Add the toggle component **Blade (with Alpine.js):** **Livewire:** **Vue:** **React:** **Svelte:** ## Features - **Three modes**: Light, Dark, System (follows OS preference) - **Instant switching**: Persists to `localStorage`, no page reload - **FOUC prevention**: Init script runs synchronously in `` before paint - **Server-side sync**: Optionally saves preference to user profile via PUT/POST - **Class-based**: Adds/removes `dark` class on `` element - **System tracking**: Listens for OS preference changes in real time - **Configurable**: Every aspect via `config/darkmode.php` and ENV variables ## Configuration Key options in `config/darkmode.php`: | Option | Default | Description | |--------|---------|-------------| | `strategy` | `class` | Dark mode strategy | | `class_name` | `dark` | Class added to `` | | `default` | `system` | Default mode (light/dark/system) | | `storage_key` | `theme` | localStorage key | | `persist_to_server` | `true` | Save to DB when authenticated | | `persist_route` | `/profile/dark-mode` | Server persistence endpoint | | `persist_method` | `PUT` | HTTP method for persistence | | `persist_field` | `dark_mode` | Request/DB field name | | `css_framework` | `null` | null = inherit from `ui-kit.css_framework` | ## Server-Side Persistence The package includes a route `PUT /darkmode/preference` that saves the preference to the user's profile. To use your own route: The toggle sends a JSON request: ## Changing Frameworks After initial installation, use the **update** or **switch** commands to change your CSS or frontend framework without losing your configuration. ### Update (Interactive) The update command shows the same stepped prompts as the installer, letting you walk through framework selection: Or pass options directly: ### Switch (Quick) The switch command is a shorthand for changing one or both frameworks in a single command: Both commands update your `.env` file and clear the config/view caches. After switching, run: ## Artisan Commands | Command | Description | |---------|-------------| | `darkmode:install` | Fresh install with interactive prompts. Detects existing installation and warns before overwriting. | | `darkmode:update` | Update framework selection with interactive prompts. Safe, does not overwrite config. | | `darkmode:switch` | Quick framework switch via flags. `--css` and/or `--frontend` required. | ### Install Options | Flag | Description | |------|-------------| | `--css=` | CSS framework: `tailwind`, `bootstrap5`, `bootstrap4` | | `--frontend=` | Frontend: `blade`, `livewire`, `vue`, `react`, `svelte` | | `--force` | Skip reinstall confirmation when already installed | ## How It Works 1. **Init script** runs synchronously in ``, reads `localStorage`, adds `dark` class before paint 2. **Toggle component** renders sun/moon/monitor icons with dropdown for Light/Dark/System 3. **On selection**: updates `localStorage`, toggles HTML class, optionally PUTs to server 4. **System mode**: listens for `prefers-color-scheme` media query changes in real time ## Testing ## License This package is open-sourced software licensed under the [MIT license](LICENSE).

All versions of laravel-darkmode-toggle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/view Version ^10.0|^11.0|^12.0|^13.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 jeremykenedy/laravel-darkmode-toggle contains the following files

Loading the files please wait ...