PHPackages                             talhakazmi/cms-renderer - 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. talhakazmi/cms-renderer

ActiveLibrary

talhakazmi/cms-renderer
=======================

Laravel Blog Renderer - Display blogs from Global CMS in your Laravel application

v1.0.4(3mo ago)011MITPHPPHP ^8.1

Since Feb 3Pushed 3mo agoCompare

[ Source](https://github.com/TalhaKazmi1/cms-renderer-laravel)[ Packagist](https://packagist.org/packages/talhakazmi/cms-renderer)[ Docs](https://github.com/TalhaKazmi1/cms-renderer-laravel)[ RSS](/packages/talhakazmi-cms-renderer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

CMS Renderer for Laravel
========================

[](#cms-renderer-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d5efcb91b073dab63974100bc0f70826432a8c71f803e46eba0ef94482213add/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74616c68616b617a6d692f636d732d72656e64657265722e737667)](https://packagist.org/packages/talhakazmi/cms-renderer)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

A **Laravel Blog Renderer** that displays blogs from [Global CMS](https://blogcms.techozon.com) in your Laravel application. Just run one command and your blog is ready!

✨ Features
----------

[](#-features)

- 🚀 **One Command Setup**: Install with a single Artisan command
- 🎨 **Beautiful Design**: Modern, responsive blog layout
- 🌓 **Light &amp; Dark Mode**: Automatic or manual theme switching
- 🔍 **Built-in Search**: Filter posts instantly
- 📄 **Pagination**: Built-in pagination support
- ⚡ **Caching**: API responses are cached for performance
- 🎯 **Zero Config**: Just add your Organization ID
- 🛡️ **SEO Ready**: Meta tags for social sharing

---

📋 Prerequisites
---------------

[](#-prerequisites)

Before installing the package, ensure you have:

- PHP 8.1 or higher
- Composer installed
- An account at [Global CMS](https://blogcms.techozon.com)

### Create a New Laravel Project (Optional)

[](#create-a-new-laravel-project-optional)

If you don't have a Laravel project yet, create one:

```
composer create-project laravel/laravel my-blog
cd my-blog
```

---

🔑 Get Your Organization ID
--------------------------

[](#-get-your-organization-id)

1. Go to [Global CMS](https://blogcms.techozon.com)
2. Sign up or log in
3. Navigate to **Integration** in the sidebar
4. Copy your **Organization ID**

---

🚀 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require talhakazmi/cms-renderer
```

### Step 2: Run the Install Command

[](#step-2-run-the-install-command)

```
php artisan cms-renderer:install
```

This will:

- ✅ Publish configuration file
- ✅ Publish view templates
- ✅ Create `BlogController`
- ✅ Add blog routes to `web.php`
- ✅ Update `.env` with CMS settings
- ✅ Create CSS stylesheet

### Step 3: Start Your Server

[](#step-3-start-your-server)

```
php artisan serve
```

Visit `http://localhost:8000/blog` to see your blog! 🎉

---

⚙️ Configuration
----------------

[](#️-configuration)

After installation, you can configure the package in `config/cms-renderer.php`:

```
return [
    // Your Organization ID from Global CMS
    'organization_id' => env('CMS_ORGANIZATION_ID', ''),

    // API URL
    'api_url' => env('CMS_API_URL', 'https://blogcms.techozon.com/api'),

    // Theme: grid, minimal, magazine, masonry
    'theme' => env('CMS_THEME', 'grid'),

    // Color Mode: auto, light, dark
    'color_mode' => env('CMS_COLOR_MODE', 'dark'),

    // Cache duration in seconds
    'cache_duration' => env('CMS_CACHE_DURATION', 300),

    // Posts per page
    'posts_per_page' => env('CMS_POSTS_PER_PAGE', 9),
];
```

### Environment Variables

[](#environment-variables)

Add these to your `.env` file:

```
CMS_ORGANIZATION_ID=your-organization-id
CMS_API_URL=https://blogcms.techozon.com/api
CMS_THEME=grid
CMS_COLOR_MODE=dark
CMS_CACHE_DURATION=300
CMS_POSTS_PER_PAGE=9
```

---

📖 Usage
-------

[](#-usage)

### Using the Controller (Default)

[](#using-the-controller-default)

After installation, the package creates a `BlogController` with two routes:

- `GET /blog` - Blog listing with search and pagination
- `GET /blog/{slug}` - Single blog post

### Using the Facade

[](#using-the-facade)

You can also use the `CmsRenderer` facade directly:

```
use TalhaKazmi\CmsRenderer\Facades\CmsRenderer;

// Get all blogs
$blogs = CmsRenderer::getBlogs(page: 1, perPage: 9, search: 'laravel');

// Get a single blog
$blog = CmsRenderer::getBlog('my-blog-slug');

// Clear cache
CmsRenderer::clearCache();
```

### Using Blade Components

[](#using-blade-components)

You can use the Blade components in your views:

```
{{-- Full blog renderer with search and pagination --}}

{{-- Just the blog list --}}

{{-- Single blog post --}}

```

---

🎨 Customization
---------------

[](#-customization)

### Custom Views

[](#custom-views)

Publish the views to customize them:

```
php artisan vendor:publish --tag=cms-renderer-views
```

Views will be published to `resources/views/vendor/cms-renderer/`.

### Custom CSS

[](#custom-css)

The CSS file is located at `public/css/cms-renderer.css`. You can modify it directly or override styles in your own CSS.

### CSS Variables

[](#css-variables)

Override these CSS variables to customize the design:

```
.cms-renderer {
  --cms-bg-primary: #0f172a;
  --cms-bg-secondary: #1e293b;
  --cms-text-primary: #f8fafc;
  --cms-text-secondary: #94a3b8;
  --cms-accent-color: #6366f1;
  --cms-border-color: #334155;
}
```

---

🔧 Advanced Usage
----------------

[](#-advanced-usage)

### Custom Controller

[](#custom-controller)

If you want more control, create your own controller:

```
