PHP code example of esanj / public-pages

1. Go to this page and download the library: Download esanj/public-pages 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/ */

    

esanj / public-pages example snippets




return [
    // Name shown on the home and error pages.
    'app_name' => env('APP_NAME', 'eSanj'),

    // Home page route.
    'home' => [
        'enabled' => env('PUBLIC_PAGES_HOME_ENABLED', true), // register the home route?
        'path'    => env('PUBLIC_PAGES_HOME_PATH', '/'),     // URI for the home page
        'view'    => 'publicpages::home',                    // view to render
    ],

    // Middleware applied to the package routes.
    'routes' => [
        'middleware' => ['web'],
    ],

    // Custom error pages.
    'errors' => [
        'enabled' => env('PUBLIC_PAGES_ERRORS_ENABLED', true), // use package error pages?
        'layout'  => 'errors::layout',                         // base layout each error view extends
    ],
];

'routes' => [
    'middleware' => ['web', 'auth'],
],



return [
    'home' => [
        'title'       => 'Welcome to our website',
        'description' => 'This is the home page provided by the esanj/public-pages package.',
    ],

    'labels' => [
        'copyright' => '© :year :brand Platform. All rights reserved.',
    ],

    'errors' => [
        '404' => [
            'title'   => 'Page Not Found',
            'message' => "The page or resource you're looking for was not found.",
        ],
        '500' => [
            'title'   => 'Internal Server Error',
            'message' => 'An internal server error occurred. Please try again later.',
        ],
        // ... other status codes
    ],
];

'505' => [
    'title'   => 'HTTP Version Not Supported',
    'message' => 'The server does not support the HTTP protocol version used in the request.',
],

  'errors' => [
      'layout' => 'layouts.error-base',
  ],
  
bash
php artisan publicpages:install

resources/
└── views/
    ├── vendor/publicpages/
    │   └── home.blade.php
    └── errors/
        ├── layout.blade.php
        ├── 404.blade.php
        ├── 500.blade.php
        └── ...
public/
└── assets/vendor/public-pages/
    ├── style.css
    └── background.png
lang/
├── en/publicpages.php
└── fa/publicpages.php
config/
└── esanj/public_pages.php
bash
php artisan vendor:publish --tag=esanj-public-pages-views
bash
php artisan publicpages:publish-config
bash
php artisan publicpages:publish-lang