Download the PHP package eolica/laravel-content-tools without Composer

On this page you can find all versions of the php package eolica/laravel-content-tools. 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 laravel-content-tools

Laravel Content Tools

Latest Version on Packagist Total Downloads

A Laravel package for editing your web frontend translations directly on the page. It uses ContentTools, a Javascript library that provides a WYSIWYG editor that can be added to any page so we can edit the HTML content inline.

Installation

You can install the package via Composer:

Once installed, if you are not using automatic package discovery, then you need to register the Eolica\LaravelContentTools\ContentToolsServiceProvider service provider in your config/app.php.

Or, alternatively, you may register it in your App\Providers\AppServiceProvider:

Public assets

Since this package uses public assets you must publish them by using the following artisan command:

To keep the assets up-to-date and avoid issues in future updates, we recommend adding the command to the post-autoload-dump scripts in your composer.json file:

The package will inject the published assets into the styles and scripts stacks, so you must add these to your layout:

Configuration

You may publish the content-tools config file with the following command:

This will create a config/content-tools.php file in your app that you can modify to set your configuration.

This is the config file with the default values:

Routes

The routes option is where you may specify the prefix applied to the package routes if for some reason conflicts with other routes in your application, also you may specify a list of middleware for these routes, by default the web group middleware is applied.

Editor

The editor option is where you may specify the ContentTools settings.

Usage

All you need to do is to add the content-tools-translation component to your Blade view.

The key property maps to a short key defined in your translation files.

You may forward any extra attributes to the component, for example, we could add the class attribute to style the content:

Fixtures

Imagine we have a home page in our website with a title inside an h1 html tag, we want this title to be translatable but we don't want our users to potentially break the h1 tag, affecting SEO negatively.

This is what fixtures allow us to do. Just add the fixture attribute with the html tag that you want to be fixed as the value:

We recommend always using fixtures to prevent users from breaking the page layout, and use non-fixture translations only when necessary.

Permissions

By default this package uses the Eolica\LaravelContentTools\PermissionHandler\TruePermissionHandler that allows anyone that enters your website to edit your translations. This is very useful in local development but in a production environment you will most likely need some kind of authentication check.

This package ships with the Eolica\LaravelContentTools\PermissionHandler\AuthGuardCheckPermissionHandler that checks if a user of a particular authentication guard is authenticated.

With that in mind, we could bind this implementation in our App\Providers\AppServiceProvider only when the application is not running in the local environment:

Now, in production, only users authenticated via the backend guard will be able to edit translations. In local development, it will fallback to the Eolica\LaravelContentTools\PermissionHandler\TruePermissionHandler implementation so we can test easily without the need of authenticating.

Creating your own permission handler

If the Eolica\LaravelContentTools\PermissionHandler\AuthGuardCheckPermissionHandler is not enough for your use case, you can make your own permission handler implementation.

A permission handler can be any class that implements the Eolica\LaravelContentTools\PermissionHandler\PermissionHandler interface:

For registering your own permission handler, you may override our default implementation from the service container in your App\Providers\AppServiceProvider:

Since our package uses the bindIf method that registers a binding if it hasn't already been registered, your custom permission handler will take precedence over our default implementation.

Combine multiple permission handlers

Maybe the Eolica\LaravelContentTools\PermissionHandler\AuthGuardCheckPermissionHandler is good for you, but you want to perform an additional type of check so you made your own permission handler for that specific case and you don't want to copy and paste the built in permission handler code.

For these scenarios this package ships with the Eolica\LaravelContentTools\PermissionHandler\CompositePermissionHandler that accepts a list of PermissionHandler.

As always, you may bind this implementation in your App\Providers\AppServiceProvider:

Using this approach, instead of potentially creating a big permission handler that performs all kind of different checks, you could create small handlers for every one of them, making the code more flexible and reusable.

Creating your own translation repository

This package ships with the Eolica\LaravelContentTools\Repository\FileTranslationRepository that persists and loads the translations from php files inside the storage/app/resources/lang folder. If you want to persist your translations in another source (database, csv, yaml, etc...), you can create your own translation repository.

A translation repository can be any class that implements the Eolica\LaravelContentTools\Repository\TranslationRepository interface:

For registering your own translation repository, you may override our default implementation from the service container in your App\Providers\AppServiceProvider:

Since our package uses the bindIf method that registers a binding if it hasn't already been registered, your custom repository will take precedence over our default implementation.

Currently missing features

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover a security vulnerability within this package, please send an email at [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-content-tools with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
brick/varexporter Version ^0.3.7
illuminate/contracts Version ^8.0 || ^9.0 || ^10.0
illuminate/filesystem Version ^8.0 || ^9.0 || ^10.0
illuminate/http Version ^8.0 || ^9.0 || ^10.0
illuminate/support Version ^8.0 || ^9.0 || ^10.0
illuminate/view Version ^8.0 || ^9.0 || ^10.0
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 eolica/laravel-content-tools contains the following files

Loading the files please wait ....