PHP code example of shipu / themevel

1. Go to this page and download the library: Download shipu/themevel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shipu / themevel example snippets


Shipu\Themevel\Providers\ThemevelServiceProvider::class,

'Theme' => Shipu\Themevel\Facades\Theme::class,

// ..
'config' => [
    'name' => 'theme.json',
    'changelog' => 'changelog.yml'
],
// ..

// ..
'config' => [
    'name' => 'theme.json',
    'changelog' => 'changelog.json'
],
// ..

Theme::set('theme-name');

Theme::get(); // return Array

Theme::get('theme-name'); // return Array

Theme::get('theme-name', true); // return Collection

Theme::current(); // return string

Theme::all(); // return Array

Theme::has(); // return bool

$themeInfo = Theme::getThemeInfo('theme-name'); // return Collection

$themeName = $themeInfo->get('name');
// or
$themeName = $themeInfo['name'];

$themeInfo = Theme::getThemeInfo('theme-name'); // return Collection

$themeName = $themeInfo->get('changelog.versions');
// or
$themeName = $themeInfo['changelog.versions'];
// or you can also call like as multi dimension
$themeName = $themeInfo['changelog']['versions'];

Theme::assets('your_asset_path'); // return string

themes('your_asset_path'); // return string

Theme::assets('your_theme_name:your_asset_path'); // return string
// or 
themes('your_theme_name:your_asset_path'); // return string

<link rel="stylesheet" href="{{ themes('app.css') }}">

<link rel="stylesheet" href="{{ themes('your_theme_name:app.css') }}">

echo Theme::lang('content.title'); // return string
// or
echo lang('content.title'); // return string

echo Theme::lang('content.title', [your replace array], 'your desire locale'); // return string
// or
echo lang('content.title', [your replace array], 'your desire locale'); // return string

echo Theme::lang('your_theme_name::your_asset_path'); // return string
// or 
echo lang('your_theme_name::your_asset_path'); // return string

Route::get('/', function () {
    Theme::set('your_theme_name');
    return view('welcome');
});

Route::get('/', function () {
    Theme::set('your_theme_name');
    return view('your_theme_name::welcome');
});

protected $routeMiddleware = [
    // ...
    'theme' => \Shipu\Themevel\Middleware\RouteMiddleware::class,
];

Route::group(['prefix' => 'admin', 'middleware'=>'theme:Your_theme_name'], function() {
    // ... Add your routes here 
    // The Your_theme_name will be applied.
});

protected $middlewareGroups = [
    'web' => [
        // ...
        \Shipu\Themevel\Middleware\WebMiddleware::class,
    ],
    // ...
];


return view('home');  // This will load the home.blade.php from the the folder you set in your `config/theme.php`


php artisan vendor:publish --provider="Shipu\Themevel\Providers\ThemevelServiceProvider"

- app/
- ..
- ..
- Themes/
    - themeone/
        - assets
            - css
                - app.css
            - img
            - js
        - lang
            - en
                -content.php
        - views/
            - layouts
                - master.blade.php
            - welcome.blade.php
        - changelog.yml        
        - theme.json
     - themetwo/   
 php
use Shipu\Themevel\Contracts\ThemeContract;

private $theme;

public function __construct(ThemeContract $theme)
{
    $this->theme = $theme
}