PHPackages                             snowsoft/nlktheme - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. snowsoft/nlktheme

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

snowsoft/nlktheme
=================

FlexPage-style JSON-driven hybrid theme engine for Laravel 13

v0.13(1mo ago)0242MITPHPPHP ^8.5

Since Jan 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/snowsoft/nlktheme)[ Packagist](https://packagist.org/packages/snowsoft/nlktheme)[ Docs](https://github.com/snowsoft/nlktheme)[ RSS](/packages/snowsoft-nlktheme/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (12)Used By (0)

NLK Theme Package
=================

[](#nlk-theme-package)

Laravel için kapsamlı bir tema yönetim paketi. Birden fazla tema desteği, component sistemı, cache yönetimi ve daha fazlası.

Özellikler
----------

[](#özellikler)

- ✅ Çoklu tema desteği
- ✅ Default theme fallback sistemi
- ✅ Component ve partial sistemi
- ✅ Section ve Stack yönetimi
- ✅ Asset yönetimi
- ✅ Cache yönetimi
- ✅ Widget sistemi
- ✅ Event sistemi
- ✅ Helper fonksiyonları
- ✅ **Güvenlik özellikleri** (XSS koruması, CSP, güvenlik header'ları)
- ✅ **Livewire desteği**
- ✅ **React + SSR desteği** (Vite entegrasyonu)
- ✅ **Inertia.js desteği**

Kurulum
-------

[](#kurulum)

```
composer require snowsoft/nlktheme
```

Temel Kullanım
--------------

[](#temel-kullanım)

### View Render

[](#view-render)

```
// Controller'da
use Theme;

public function index()
{
    return Theme::view('home');
}

// Veya helper ile
return theme()->view('home');
```

### Theme Ayarlama

[](#theme-ayarlama)

```
// Belirli tema kullan
Theme::uses('tema2')->layout('main')->view('home');

// Helper ile
theme('tema2', 'main')->view('home');
```

Default Theme Fallback
----------------------

[](#default-theme-fallback)

Bir dosya mevcut temada bulunamazsa, otomatik olarak default temadan yüklenir.

### Config Ayarları

[](#config-ayarları)

`config/theme.php`:

```
'defaultTheme' => 'default',
'useDefaultThemeFallback' => true, // ✅ true yapın
```

### Örnek Kullanım

[](#örnek-kullanım)

```
// tema2 temasında header.blade.php yoksa
// otomatik olarak default temasından yükler
Theme::partial('header');

// tema2/views/home.blade.php yoksa
// default/views/home.blade.php arar
Theme::scope('home');
```

Partial ve Component
--------------------

[](#partial-ve-component)

### Partial

[](#partial)

```
// Partial render
Theme::partial('header', ['title' => 'Welcome']);

// Watch partial (önce temada, sonra app'te ara)
Theme::watchPartial('footer');

// Helper
{!! theme_partial('header') !!}
```

### Component

[](#component)

```
// Component kaydet
theme()->component('card', 'components.card');

// Component render
theme()->renderComponent('card', ['title' => 'Card Title', 'body' => 'Content']);

// Helper
{!! theme_component('card', ['title' => 'Test']) !!}
```

### Blade'de Kullanım

[](#bladede-kullanım)

```
@partial('header')
{!! theme_component('card', ['title' => 'Hello']) !!}
```

Section Sistemi
---------------

[](#section-sistemi)

```
// Section başlat
theme()->startSection('sidebar');
    echo "Sidebar content";
theme()->stopSection('sidebar');

// Section içeriğini al
$sidebar = theme()->getSection('sidebar');

// Section var mı kontrol et
if (theme()->hasSection('sidebar')) {
    echo theme_section('sidebar');
}
```

### Blade Helper

[](#blade-helper)

```
{!! theme_section('sidebar', 'Default content') !!}

@if(has_theme_section('sidebar'))
    {!! theme_section('sidebar') !!}
@endif
```

Stack Sistemi
-------------

[](#stack-sistemi)

Birden fazla yerde içerik toplamak için:

```
// Stack başlat
theme()->startStack('scripts');
echo '';
theme()->pushStack('scripts');

// Başka yerde
theme()->startStack('scripts');
echo '';
theme()->pushStack('scripts');

// Tüm scriptleri al
echo theme()->getStack('scripts');
```

### Blade Helper

[](#blade-helper-1)

```
{!! theme_stack('scripts') !!}
```

Asset Yönetimi
--------------

[](#asset-yönetimi)

### Helper Fonksiyonları

[](#helper-fonksiyonları)

```
// Asset URL
theme_asset('css/style.css');
// Output: /themes/default/assets/css/style.css

// CSS tag
theme_css('css/style.css');
// Output:

// JS tag
theme_js('js/app.js');
// Output:

// Image tag
theme_image('images/logo.png', 'Logo', ['class' => 'logo']);
```

### Blade'de Kullanım

[](#bladede-kullanım-1)

```

    {!! theme_css('style.css') !!}

    {!! theme_js('app.js') !!}

```

Theme Data
----------

[](#theme-data)

Global tema verilerini yönetme:

```
// Veri set et
theme()->setData('user', $user);
theme()->setMultipleData(['key1' => 'val1', 'key2' => 'val2']);

// Veri al
$user = theme()->getData('user');
$allData = theme()->getAllData();

// Helper
theme_set('key', 'value');
$value = theme_get('key', 'default');
```

Cache Yönetimi
--------------

[](#cache-yönetimi)

```
// Tüm cache'i temizle
theme()->clearCache();

// Belirli temanın cache'ini temizle
theme()->clearThemeCache('tema2');

// Temayı yeniden yükle
theme()->reload();

// Helper
theme_cache_clear();
theme_cache_clear('tema2');
```

View Kontrolü
-------------

[](#view-kontrolü)

```
// View var mı kontrol et
if (theme()->viewExists('home')) {
    return theme()->view('home');
}

// Theme'deki tüm view'ları listele
$views = theme()->getThemeViews();

// Helper
if (has_theme_view('partial.header')) {
    {!! theme_partial('partial.header') !!}
}

// Varsa render et
render_if_exists('partial.header', [], 'Default content');
```

Helper Fonksiyonlar
-------------------

[](#helper-fonksiyonlar)

### Metin İşlemleri

[](#metin-i̇şlemleri)

```
// Metin kısaltma
theme_truncate('Long text here...', 50);
// Output: "Long text here..."

// Time ago
time_ago('2024-01-01 12:00:00');
// Output: "2 hours ago"

// Number format
number_format_short(1000);
// Output: "1K"
number_format_short(1500000);
// Output: "1.5M"
```

### Navigation Helper

[](#navigation-helper)

```
// Active class
active_class('home', 'active');
// Returns: 'active' if current route is 'home'

// Blade'de
Home
```

Widget Sistemi
--------------

[](#widget-sistemi)

```
// Widget render
Theme::widget('Menu', ['items' => $menuItems]);

// Blade'de
@widget('Menu', ['items' => $items])
```

Region (Alan) Yönetimi
----------------------

[](#region-alan-yönetimi)

```
// Region set et
theme()->set('meta', '');

// Region append
theme()->append('scripts', '...');

// Region prepend
theme()->prepend('styles', '...');

// Region al
$meta = theme()->get('meta', 'default');

// Region var mı kontrol et
if (theme()->has('meta')) {
    echo theme()->get('meta');
}

// Blade'de
@get('meta')
@getIfHas('meta')
```

Event Sistemi
-------------

[](#event-sistemi)

### Theme Event'leri

[](#theme-eventleri)

```
// Theme yükleme öncesi
Theme::fire('before', $theme);
Theme::fire('asset', $asset);
Theme::fire('beforeRenderTheme', $theme);
Theme::fire('beforeRenderLayout.main', $theme);
Theme::fire('after', $theme);
```

### Config'de Event Tanımlama

[](#configde-event-tanımlama)

`themes/tema2/config.php`:

```
return [
    'events' => [
        'before' => function($theme) {
            $theme->set('title', 'My Site');
        },
        'beforeRenderLayout.main' => function($theme) {
            $theme->set('description', 'Main layout');
        },
    ],
];
```

Event Usage Example
-------------------

[](#event-usage-example)

```
// ThemeServiceProvider.php
public function boot()
{
    Theme::composer('*', function($view) {
        $view->with('currentUser', auth()->user());
    });
}
```

Advanced Features
-----------------

[](#advanced-features)

### Compile and Cache

[](#compile-and-cache)

```
$content = theme()->compileAndCache(
    'Welcome {{ $name }}',
    ['name' => 'John'],
    'welcome_cache',
    3600 // TTL
);
```

### String Compilation

[](#string-compilation)

```
$html = theme()->blader('Hello {{ $name }}', ['name' => 'World']);
```

### Get Compiled Path

[](#get-compiled-path)

```
$compiledPath = theme()->getCompiledPath('theme.tema2.views.home');
```

Tema Yapısı
-----------

[](#tema-yapısı)

```
themes/
├── default/
│   ├── assets/
│   │   ├── css/
│   │   ├── js/
│   │   └── images/
│   ├── views/
│   │   └── *.blade.php
│   ├── layouts/
│   │   ├── main.blade.php
│   │   └── layout.blade.php
│   ├── partials/
│   │   ├── header.blade.php
│   │   └── footer.blade.php
│   ├── components/
│   │   └── card.blade.php
│   ├── config.php
│   └── theme.json
│
└── tema2/
    ├── assets/
    ├── views/
    ├── layouts/
    └── ...

```

Config Dosyası
--------------

[](#config-dosyası)

`config/theme.php`:

```
return [
    'assetUrl' => '/',
    'defaultTheme' => 'default',
    'useDefaultThemeFallback' => true,  // Default theme fallback
    'version' => '1.0.0',
    'themeDefault' => 'default',
    'layoutDefault' => 'layout',
    'themeDir' => 'themes',
    'themeURL' => 'themes',
    'templateCacheEnabled' => true,
    'autoReload' => false,
    'defaultEngine' => 'blade',
    'minify' => false,
    'namespaces' => [
        'widget' => 'App\Widgets'
    ],
    'events' => [
        // Global events
    ],
];
```

Middleware Kullanımı
--------------------

[](#middleware-kullanımı)

```
// Route'da
Route::get('/home', [HomeController::class, 'index'])
    ->middleware('theme:tema2,main');

// Controller'da
public function index()
{
    return theme()->view('home');
}
```

Helper Listesi
--------------

[](#helper-listesi)

- `theme($theme, $layout)` - Theme instance al
- `theme_asset($path)` - Asset URL
- `theme_css($path, $media)` - CSS tag
- `theme_js($path, $defer)` - JS tag
- `theme_image($path, $alt, $attrs)` - Image tag
- `theme_partial($view, $args)` - Partial render
- `theme_component($name, $data)` - Component render
- `theme_section($section, $default)` - Section get
- `theme_stack($name)` - Stack get
- `active_class($path, $active)` - Active class
- `theme_truncate($text, $limit)` - Truncate
- `time_ago($datetime)` - Time ago
- `number_format_short($number)` - Short number
- `theme_cache_clear($theme)` - Clear cache
- `has_theme_view($view)` - Check view exists
- `has_theme_section($section)` - Check section
- `render_if_exists($view, $args, $default)` - Render if exists
- `theme_set($key, $value)` - Set theme data
- `theme_get($key, $default)` - Get theme data
- `theme_schema($schema)` - Generate JSON-LD schema
- `theme_product_schema($data)` - Generate Product schema
- `theme_organization_schema($data)` - Generate Organization schema
- `theme_breadcrumb_schema($items)` - Generate BreadcrumbList schema
- `theme_article_schema($data)` - Generate Article schema
- `theme_video_schema($data)` - Generate Video schema

Artisan Komutları
-----------------

[](#artisan-komutları)

Paket, tema yönetimi için çeşitli Artisan komutları sunar:

```
# Tema oluştur
php artisan theme:create mytheme

# Temaları listele
php artisan theme:list

# Temayı kopyala
php artisan theme:duplicate default newtheme

# Temayı sil
php artisan theme:destroy oldtheme

# Widget oluştur
php artisan theme:widget ProductSlider
```

Detaylı kullanım için [Artisan Komutları Dokümantasyonu](docs/ARTISAN_COMMANDS.md) dosyasına bakın.

Gelişmiş Özellikler
-------------------

[](#gelişmiş-özellikler)

Paket artık modern frontend framework'leri ve gelişmiş güvenlik özellikleri ile birlikte geliyor:

### Güvenlik

[](#güvenlik)

- XSS koruması ve HTML sanitization
- Content Security Policy (CSP) desteği
- Güvenlik header'ları (X-Frame-Options, X-XSS-Protection, vb.)
- View path validation

### Modern Frontend Desteği

[](#modern-frontend-desteği)

- **Livewire**: Server-side reactive component'ler
- **React + SSR**: Vite entegrasyonu ve server-side rendering
- **Inertia.js**: SPA deneyimi için tam destek

Detaylı dokümantasyon için:

- [Hızlı Başlangıç](docs/QUICK_START.md)
- [Gelişmiş Özellikler](docs/ADVANCED_FEATURES.md)
- [Artisan Komutları](docs/ARTISAN_COMMANDS.md)
- [Page Builder](docs/PAGE_BUILDER.md)
- [SEO &amp; Rich Snippets](docs/SEO_RICH_SNIPPETS.md)
- [Sorun Giderme](docs/TROUBLESHOOTING.md)
- [Gelecekteki Özellikler](docs/FUTURE_FEATURES.md)

License
-------

[](#license)

[LICENSE](LICENSE)

Support
-------

[](#support)

Sorunlarınız için issue açabilirsiniz.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance89

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Recently: every ~36 days

Total

11

Last Release

55d ago

PHP version history (4 changes)v0.03PHP &gt;=7.3

v0.04PHP &gt;=8.3

v0.12PHP &gt;=8.2

v0.13PHP ^8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4568234?v=4)[snowsoft](/maintainers/snowsoft)[@snowsoft](https://github.com/snowsoft)

---

Top Contributors

[![snowsoft](https://avatars.githubusercontent.com/u/4568234?v=4)](https://github.com/snowsoft "snowsoft (70 commits)")

---

Tags

jsonlaravelthemesectionsshopifypagebuilder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/snowsoft-nlktheme/health.svg)

```
[![Health](https://phpackages.com/badges/snowsoft-nlktheme/health.svg)](https://phpackages.com/packages/snowsoft-nlktheme)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[spinen/laravel-clickup

SPINEN's Laravel Package for ClickUp.

282.2k](/packages/spinen-laravel-clickup)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
