PHPackages                             neon/site - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. neon/site

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

neon/site
=========

Neon CMS' website handler.

2.0.5(2y ago)06163MITPHPPHP &gt;=8.0

Since Mar 11Pushed 1y ago3 watchersCompare

[ Source](https://github.com/elementary-interactive/neon-site)[ Packagist](https://packagist.org/packages/neon/site)[ RSS](/packages/neon-site/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (31)Used By (3)

NEON — Site
===========

[](#neon--site)

Handles sites to be able to run on it.

Requirements
------------

[](#requirements)

- `"neon/model-uuid": "^1.0"`

Install
-------

[](#install)

Easily install the composer package:

```
composer require neon/site
```

Then there are two ways to use the site: You can store your settings both in config file or in database. It depends on your wishes, you can install package on both ways.

### Install config files

[](#install-config-files)

### Install database migrations

[](#install-database-migrations)

Then you should install database migrations by:

```
php artisan vendor:publish --provider=\"Neon\\Site\\NeonSiteServiceProvider\"
```

Usage
-----

[](#usage)

Site Middleware as of 2.0 does not add automatically to the array of middleware, so, if you want to use it, you should set up that for the routing:

```
use Neon\Site\Facades\Site;

Site::patterns();
```

This command will define the Site rules for Laravel's router. After this definition you can use it for different cases:

```
use Neon\Site\Facades\Site;
use Neon\Site\Http\Middleware\SiteMiddleware;

Route::group([
    'domain'      => Site::domain('domain_slug'),
    'middleware'  => SiteMiddleware::class
  ], function () {

  Route::group([
    'middleware'  => [SiteMiddleware::class]
  ], function () {

    Route::get('/', function() {
      echo 'Hello '.app('site')->current()->locale.' /// DOMAIN';
    });
  });
});
```

If you want to separate routing by locale you can use it like this:

```
    'prefix'      => 'en',
```

You can also use site as prefixes:

```
use Neon\Site\Facades\Site;
use Neon\Site\Http\Middleware\SiteMiddleware;

Route::group([
    'prefix'      => Site::prefix('prefix_slug'),
    'middleware'  => SiteMiddleware::class
  ], function () {
  ...
});
```

### SEO functions

[](#seo-functions)

#### Use favicon

[](#use-favicon)

Favicon could be set on admin UI. After that, yo can easily put it into the header right after the `` tag:

```

  ...

  ...

```

### Site dependent models

[](#site-dependent-models)

If you want something, like a Menu, what is rlated to the Site, then you just have to use the dependency trait.

```
