Download the PHP package r0073rr0r/laravel-theme-switcher without Composer

On this page you can find all versions of the php package r0073rr0r/laravel-theme-switcher. 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-theme-switcher

Laravel Theme Switcher

A Laravel package for Jetstream and Livewire applications that provides a polished light, dark, and system theme switcher with persistence, package assets, and a Jetstream appearance form.

Packagist Version Total Downloads PHP Version License Tests PHP Composer GitHub Stars

โœจ Features

Table of Contents

๐Ÿ“‹ Requirements

๐Ÿš€ Installation

Install the package via Composer:

Publish the package config:

Publish the package views if you want to override them:

Publish the package translations if you want to customize the text:

Publish the package CSS:

Publish the package JavaScript:

Run the migration so the package can persist the user's theme_preference value on the users table:

๐Ÿ”„ Updating

When updating the package, republish the resources you actually use so your application gets the latest views, translations, and frontend files:

If you have customized any published files, review the changes before overwriting them.

โš™๏ธ Setup

1. Import the package CSS

Import the published stylesheet into your application's main stylesheet, for example in resources/css/app.css:

If your application uses the package views directly, Tailwind also needs to scan them so utility classes such as h-10, w-10, and rounded-full are generated.

For Tailwind CSS v4, add this to resources/css/app.css:

If you published the package views instead, point Tailwind to your published copies:

For Tailwind CSS v3, add the same paths to the content array in tailwind.config.js.

2. Import the package JavaScript

Import the published JavaScript into your application's main JS entry file, for example in resources/js/app.js:

The package JavaScript expects a global theme manager at window.masonTheme with methods compatible with:

This keeps the Livewire component state synchronized with the browser theme state.

3. Add the startup script to your layout <head>

To apply the theme before the page paints, add the package head component inside your main layout <head>, for example in resources/views/layouts/app.blade.php:

This is the recommended integration point because it renders the inline startup script with the current server-side preference and updates the dark class before the UI flashes.

If you prefer a plain include instead of a Blade component, you can use:

๐Ÿง  Configuration

After publishing the package config, you can control the switcher's default behavior without editing package files:

What these options are for:

Examples:

๐Ÿงช Usage

Theme Toggle

Render the Livewire component wherever you want the theme toggle button:

Or:

The component:

Appearance Form

The package also registers a Livewire component alias for Jetstream profile settings:

If you want to show it on the default Jetstream profile page, open:

Then add this block near the top of the main content area, for example after the profile information form:

If you prefer to reference the class directly, you can also use:

The form view rendered by that component comes from the package:

If you publish the package views, you can override that file and adapt it to your own account settings flow.

๐ŸŒ Translations

The package loads its own translations automatically through the theme-switcher namespace, so publishing translations is optional.

Example keys:

How translation fallback works:

This package already includes:

That means a typical application with fallback_locale=en will still show English text even when the active locale has no dedicated theme-switcher translation yet.

๐ŸŽจ Customization

After publishing, you can customize these package resources:

The startup head script is provided by the package view component:

๐Ÿ“ Notes

โœ… Testing

The package test suite is written with Pest and covers configuration helpers, Livewire components, head bootstrap rendering, and persistence behavior.

Run the tests locally with:

๐Ÿ“„ License

This package is open-sourced software licensed under the MIT license.

๐Ÿค Contributing

Pull requests are welcome. For larger changes, open an issue first so the scope is clear before implementation.


All versions of laravel-theme-switcher with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0 || ^13.0
livewire/livewire Version ^3.0 || ^4.0
laravel/jetstream Version ^5.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 r0073rr0r/laravel-theme-switcher contains the following files

Loading the files please wait ...