{"id":19779255,"url":"https://github.com/isaeken/laravel-theme-system","last_synced_at":"2025-04-30T21:31:32.391Z","repository":{"id":45524453,"uuid":"280896796","full_name":"isaeken/laravel-theme-system","owner":"isaeken","description":"Theme system for Laravel Framework.","archived":false,"fork":false,"pushed_at":"2022-07-14T06:55:37.000Z","size":56,"stargazers_count":70,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-01T15:28:24.046Z","etag":null,"topics":["blade","framework","laravel","php","system","theme"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isaeken.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null},"funding":{"github":"isaeken"}},"created_at":"2020-07-19T15:41:19.000Z","updated_at":"2024-03-18T13:49:46.000Z","dependencies_parsed_at":"2022-09-22T10:13:20.506Z","dependency_job_id":null,"html_url":"https://github.com/isaeken/laravel-theme-system","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Flaravel-theme-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Flaravel-theme-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Flaravel-theme-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Flaravel-theme-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaeken","download_url":"https://codeload.github.com/isaeken/laravel-theme-system/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224224964,"owners_count":17276431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blade","framework","laravel","php","system","theme"],"created_at":"2024-11-12T05:34:03.464Z","updated_at":"2024-11-12T05:34:04.275Z","avatar_url":"https://github.com/isaeken.png","language":"PHP","funding_links":["https://github.com/sponsors/isaeken"],"categories":[],"sub_categories":[],"readme":"\n# Laravel Theme System\n\n![Laravel Theme System](https://banners.beyondco.de/Laravel%20Theme%20System.png?theme=light\u0026packageManager=composer%20require\u0026packageName=isaeken/laravel-theme-system\u0026pattern=architect\u0026style=style_1\u0026description=Make%20multiple%20themes%20for%20your%20Laravel%20application\u0026md=1\u0026showWatermark=1\u0026fontSize=100px\u0026images=https://laravel.com/img/logomark.min.svg)\n\n[![Latest Version](https://img.shields.io/github/v/tag/isaeken/laravel-theme-system?sort=semver\u0026label=version)](https://packagist.org/packages/isaeken/laravel-theme-system)\n![CircleCI](https://img.shields.io/circleci/build/github/isaeken/laravel-theme-system)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/isaeken/laravel-theme-system/Check%20\u0026%20fix%20styling?label=code%20style)](https://github.com/isaeken/laravel-theme-system/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/isaeken/laravel-theme-system.svg?style=flat-square)](https://packagist.org/packages/isaeken/laravel-theme-system)\n\n## Installation and setup\n\n### Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require isaeken/laravel-theme-system\n```\n\n### Setup\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --provider=\"IsaEken\\ThemeSystem\\ThemeSystemServiceProvider\" --tag=\"theme-system-config\" --tag=\"theme-system-migrations\"\nphp artisan migrate\n```\n\nRun the following command in the terminal for initializing:\n\n````shell\nphp artisan themes:init\n````\n\n## Usage\n\n### Change the theme in runtime\n\n````php\ntheme_system()-\u003esetTheme('your-theme-name');\n````\n\n### Get current theme name\n\n````php\ntheme_system()-\u003egetCurrentTheme();\n````\n\n### Set theme per user\n\n````php\n// \\App\\Models\\User.php\nclass User extends Authenticatable\n{\n    use \\IsaEken\\ThemeSystem\\Traits\\CanChooseTheme; // Add this\n    \n    // ...\n}\n````\n\n````php\n// In your controller or middleware\nauth()-\u003euser()-\u003etheme; // theme for user.\nauth()-\u003euser()-\u003etheme = 'default'; // theme is saved to db.\n\nauth()-\u003euser()-\u003ethemeApply(); // changed current theme to user theme.\n````\n\n### Creating theme\n\nRun the following command in the terminal.\n\n````shell\nphp artisan make:theme your-theme-name\n````\n\nChange theme in PHP or application config.\n\n### Webpack\n\n\u003e Do not change the main ``webpack.mix.js`` file.\n\nA special ``\"webpack.mix.js\"`` file is created for each theme.\n\nThe ``\"webpack.mix.js\"`` file of the default theme is in the ``\"resources\"`` folder.\n\nYou can continue to use the ``\"webpack.mix.js\"`` as normal in the default theme.\n\nHowever, in themes you should use it as in the example.\n\n````js\nconst mix = require('laravel-mix');\n\nmix\n    .js(themeResourceRoot + '/js/app.js', 'js')\n    .postCss(themeResourceRoot + '/css/app.css', 'css', [\n        //\n    ]);\n\nexports.mix = mix;\n````\n\n### Middleware to set a theme\n\nRegister ``ThemeMiddleware`` in ``app\\Http\\Kernel.php``:\n\n````php\nprotected $routeMiddleware = [\n    // ...\n    'theme' =\u003e \\IsaEken\\ThemeSystem\\Http\\Middlewares\\ThemeMiddleware::class,\n];\n````\n\nExample usages:\n\n````php\nRoute::group(['middleware' =\u003e 'theme:your-theme-name'], function () {\n    // ...\n});\n\nRoute::get('/hello-world', fn () =\u003e 'Hello World!')-\u003emiddleware('theme:your-theme-name');\n````\n\n### If you need to advanced methods, see ThemeSystem class.\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Isa Eken](https://github.com/isaeken)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaeken%2Flaravel-theme-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaeken%2Flaravel-theme-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaeken%2Flaravel-theme-system/lists"}