Download the PHP package monstrex/voyager-site without Composer

On this page you can find all versions of the php package monstrex/voyager-site. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package voyager-site

Voyager Site

Latest Version on Packagist Total Downloads Build Status

The package is an implementation of a simple but useful subsystem of a basic content organization for the Voyager Admin Panel package. Using this package you can rapidly and easily build small and medium-size scale web-sites.

Features

Installation

Requirement

You should fully install the package Voyager Extension before.

Via Composer

Then run install command:

Publish config if you need:

Usage

Config file

Site Settings

Site settings is a flexible and extendable easy to use settings subsystem integrated in the package.

You can use and modify exist settings and group and add you own group and settings. To retrieve certain setting you may use helper function:

Some of the site settings used by the internal package functions will override Laravel .env settings.

The settings have built-in SMTP mail parameters and the mail sending test function.

You can easily modify settings or add new ones using JSON-like setting fields configuration by clicking on the Edit action.

Built-in field types are

Localizations

The package provides DB-like localization storage for all strings you need to localize. Just add language columns to the storage and it'll be used instead a localization in files.

Pages

The VPage module allows you manage basic pages on your site. You can easily find and prepare any page and its related attributes - like SEO data, breadcrumbs and data sources and then send this data collection to a view. It can be used by two ways: implementing the PageTrait class into your controller or using the facade VPage. Look for the examples:

Example #1:

Example #2:

What the example does:

Available variables in the View:

Page Data Sets

It is a subsystem to retrieve additional data necessary to use on a certain page. The data are different record collections from different models.
To use it you need having details field in your model, the record of that filled up with a certain JSON data structure:

Note: the attached data defined in JSON structure will load automatically during a call the create method.

And in your View template you can easily use it like this:

Note: this type of the JSON data structure also uses in Block/Widget subsystems.

Override default templates on the page

You may want to override default template names on a certain page. To do this define new template names in details field:

Overriding in controllers (using page trait):

Page SEO parameters

SEO parameters are generated inside the create Page method. By default:

SEO Title - from the page seo fields group if an appropriate field is not empty, otherwise checks field Title, if the field is not present then checks a site setting seo.seo_title, if the setting is empty then takes value from site setting general.site_title. And at last the given value passed through seo title template site setting - seo.seo_title_template.

You can override the SEO Title value with method VPage::setSeoTitle('new title').

META Description - from the page seo fields group if an appropriate field is not empty, otherwise checks a site setting seo.meta_description, if the setting is empty then takes value from site setting general.site_description.

You can override the META Description value with method VPage::setMetaDescription('new description').

META Keywords - from the page seo fields group if an appropriate field is not empty, otherwise checks a site setting seo.meta_keywords.

You can override the META Keywords value with method VPage::setMetaKeywords('new keywords').

Page Breadcrumbs

When you call the Page create method it adds the first element to the Breadcrumbs array.

How sets the first breadcrumb element:

To add other elements to the Breadcrumbs array just use the method VPage::addBreadcrumbs($title, $path)

Also you can use the method buildBreadcrumbs() to build a chain of nested pages which hold in the Parents property. This property sets automatically when you load and create page instance using the method setParents($page, $parent_field_name) Where $page is a current page instance and $parent_field_name is a field name where holds ID with a parent of the current page.

Note: additional necessary setup for models - to build parents chain, breadcrumbs and get banner

Blocks / Widgets

Blocks / Widgets is a flexible subsystem provides your a way to implement and organize additional content parts and include them into your page.
Each block has the follow structure:

Status - If disabled the block will be ignored.

Title - Visible only in admin panel.

Block key - A key (slug) using to find and render this block.

Region position - Used for grouping blocks and then render them as a group in certain order. Available positions can be edited in the Regions menu.

Block content - Main block content. You can use as pure HTML code or as a Liquid template.

Available variables:

Example #1 (usage of image list):

Where image.url represent relative URL of image. Crop filter - crop and store (if not stored yet) the image with given sizes. -url filter - makes full url from the relative one. image.full_url - Full url of the image. **image.props.*** - Custom image properties.

Example #2 (usage data sources):

For this kind of template you need to define data sources JSON-like structure in the options field:

Where "model" is a model name equal to registered model name in the Voyager Bread system.

Example #3 (usage internal block's fields):

Also you can get any field of the certain block using helper:

Block render

Just use helper render_block('key'). Instead of key you can use block Title or ID (numeric).

Region (group) render and URL path rules.

It can be used to organize and render a group of blocks whit the same region (group) name whenever you need it in your template. For instance:

Will render all blocks where this region (group) 'content-before' has been set. And the package will check all blocks if they can be rendered - what depends on the setting "URL paths Rules":

It's a drupal-like block system rendering. That can depend on the current URL or not.

Forms

Similar to block. But you can use only limited sets of internal variables. The 'send.form' is implemented inside the form subsystem with the sendForm($request) method. It sends any form data including attached files. Also you can use Google ReCaptcha 2 form protection. Just add the line where you need inside your form:

And add recaptcha validation rules to the form options:

Template part:

Parameters part:

If parameter 'to_address' is not present will be used config setting: mail.to_address.

Inside form template you can use internal vars:

To render form from a view use helper renderForm($key, $subject = null, $suffix = null):

To render inside a block:

More examples:

Also you can use AJAX form sending. The package implements JS part for AJAX sending, just include jQuery library and this line in your view (or you can use your own JS function):

AJAX Example:

Page layout render

The special system allows you to manage group of the blocks or forms and fields on a certain page. You can easily add/remove blocks, forms and fields (and sort them) in the edit page mode and then render using helper:

Where $page is a page instance.

Or manually:

Built-in Shortcodes

block - Render a block. Ex: [block name="top-line"]

form - Render a form. Ex: [form name="top-line" subject="Form subject" suffix="-callback-form"]

div - Render div wrapper. Nested elements not allowed. Ex: [div class="wrapper"] CONTENT [/div]

image - Render html code an image (and crop, convert an image) using media files attached to the current content instance.

Available options:
field - Media file field related with attached media files
index - Index of the file in the collection, begins with 1.
url - Path to the image (if not used field and index)
class - Classes for the image tag. Ex: class="lazy responsive"
lightbox - Make a lightbox wrapper. Ex: lightbox="true"
lightbox_class - Classes for the lightbox wrapper
width - Width attribute fot the image tag.
height - Height attribute fot the image tag.
picture - Add picture wrapper.
crop - Crop the image.
format - Convert the image to webp, jpg, png.

Examples:
[image field="image" index="1"]
[image url="/images/banners/banner-1.jpg"]
[image field="images" index="3" picture="true" format="webp" width="100" height="200" crop="400,400" class="lazy-class" lazy="true" lightbox_class="image-gallery"]

Built-in Liquid filters

url - Return full url for a given path. Ex: {{ '/images/file.jpg' | url }}
route - Return laravel route path. Ex: {{ 'page' | route: 'slug' }}
crop - Crop (and/or convert) image. Ex: {{ this.images[0].url | crop: 300,300,'webp',75 }}
webp - Convert an image into webp format. Ex: {{ this.images[0].url | webp }}
site_setting - Get site settings parameters. Ex: {{ 'mail' | site_setting: 'to_address' }} menu - Render a menu. Ex: {{ 'main-menu' | menu: 'template.menus.main' }}
block - Render a block. Ex: {{ 'top-line' | block }}
form - Render a form. Ex: {{ 'callback-form' | form: 'Form subject','-callback' }}
trans - Translate string using current locale. Ex: {{ '[[en]]English string[[ru]]Русская строка' | trans }}
lang -- Translate string using language files. Ex: {{ 'auth.password' | lang }}
view -- Render blade view using Data vars. Ex: {{ data | view: 'template.partials.portfolio-list' }}
service -- Get data using service method (and pass it to the View). Ex: {{ 'getPortfolio' | service: '\App\Services\DataService' | view: 'template.partials.portfolio-list' }}

Custom Liquid filters

You can add your own liquid filters using a custom class. You should add this class to the configuration:
'template_filters' => 'App\Template\TemplateFilters'

Helpers

translit_cyrillic($string) - Transliteration given cyrillic string into latin symbols string.
get_file($file_path) - Return URL of the given file_path, can unpack JSON voyager file coded format.
store_post_files(Request $request, $slug, $field, $public = 'public') - Store files given in $request $field and return JSON Voyager array of files links and their original names.
generate_filename($file, $path) - Return new file name if $file exists on given $path.
site_setting($key, $default = null) - Return a site setting (or default value).
site_settings_group($group_key) - Return a group of site settings.
get_image_or_create($image_path, $width, $height, $format, $quality) - Return link to the requested image with a given width and/or height, format and quality. If it not exists it'll be created.

Where:
$image_path - Full URL with domain or relative (to domain).
$width - new image width or Null,
$height - new image height or Null (if used both - width and height - the image will be cropped),
$format - 'webp', 'png', 'jpg': the image will be converted to webp, png, jpg,
$quality - quality level of the new image.

get_first_not_empty(array $values) - Returns the first not empty element in a given array.
render_block($key) - Render block.
render_region($key, $path = null) - Render region (group of blocks with the same region/group key).
render_form($key, $subject = null, $suffix = null) - Render form with a given key. Accept also Subject field and Suffix for using in a form.
render_layout($layout, $page) - Render Page Layout (page group of blocks, forms and page fields).
get_block_field($block_key, $field_name) - Return field value of a given block key.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.


All versions of voyager-site with dependencies

PHP Build Version
Package Version
Requires monstrex/voyager-extension Version *
liquid/liquid Version ^1.4
webwizo/laravel-shortcodes Version ^1.0.20
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package monstrex/voyager-site contains the following files

Loading the files please wait ....