Download the PHP package dietercoopman/smart without Composer

On this page you can find all versions of the php package dietercoopman/smart. 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 smart

smart image manipulation

Latest Version on Packagist Downloads

Blade components for easy image manipulation and file downloads

This package makes it possible to

Typical use case

For smart image

Serving images that are stored wherever you want, changing the size and look&feel of an image without changing the original source. So you can use 1 image to once serve them for example grey on an overview page, but full color on a detail page.

For smart download

Downloading files that are stored wherever you want this can be your storage folder a Laravel disk or a https path

For smart div

Sometimes you have to add background images to div blocks, this can be achieved with smart-div. You can apply templates to the background images.

Watch me explaining what smart is on YouTube

Schermafbeelding 2021-12-12 om 15 26 36

Installation

You can install the package via composer

you can optionaly publish the config file if you want to use templates or change some settings ( see advanced usage with templates )

Smart Image

Full example

In this example the images are stored on S3. We want the images to be served all grey and at the same height, but also rotated 15 degrees. They are encoded as webp and given a good name, search engines will love them, all with 1 smart tag.

overview

The blade component

Smart provides you with a blade component as replacement for the normal <img> html tag. You can pass in all default html attributes like the class tag they will be passed to the rendered html.

The attributes

src

Specify the source of your image with src, this can be a https path, or a location on your server ( like /mnt/images ) or a Laravel disk to unlock serving images from S3, Dropbox or other custom filesystem.

data-disk

With this data-disk attribute you tell smart on which Laravel disk the src specified can be found.

data-src

Specify the source as exposed to the browser with data-src. That is the source as shown in the rendered html, so you can expose friendly names to end users or search engines

data-template

Specify the template to apply with data-template ( see advanced usage with templates ) to apply a pre-configured template to your images.

Examples

Base example

This example will serve a file that is stored in the storage folder

Loading images from Laravel disks

This example loads an image from a S3 compatible Laravel disk with data-disk

Resizing images

This example will serve a file that is stored in the storage folder and resize it to 400px ( real file resize ! ) maintaining the aspect ratio.

Changing the name of the served content

The default name of the served images is a cache key, if you want to give it a more friendly name you can specify it with data-src

Using templates

With templates you can apply a predefined set of settings to your images. Typically handy if you are using images in several places of for example an e-commerce site.

Caching

The images are cached with the intervention/image cache. Default, the package will generate a key to store the images in the cache. This key will be used to build the src of the file, making it possible for browsers to cache the image. This key is random generated, but you can override it if you want a more descriptive name for your images ( see data-src ) .

Advanced usage with templates

Via the data-templateattribute you can specify which template your image should use. The templates are configurable in the config/smart.php config file.

Here's the default config

The path key defines the url prefix for smart, it defaults to smart but it can be whatever you want.

There are two templates defined by default, small and big. Within the configuration you can define what settings need to be applied to your images.
The possible settings are the method names as stated in the intervention image API.
You can create as many template as you want.

For example, if you want to use the resize method from intervention/image then you define a resize array with the arguments as array value, defined as a sub array. All methods from the api can be used. Here's an example of a config and the result

fullexample

if a given source is not found than the image defined in file-not-found is returned (default a 1x1 png), here you can specify any image stream or image path.

Using the full API of intervention/image

You can even go further, you can apply the full API of intervention/image by passing arrays, this examples draws a rectangle onto your resized image. The most simple way of doing it is by definig a new array with the method names of the callback as array keys and the arguments as array value, then passing this array as if you would pass a callback to an intervention/image method.

Smart download

Smart download makes it possible to download any type of document with a simple tag. No need to program a backend portion of code to retrieve file streams and serve them, its all handled by smart.

The blade component

Smart download provides you with a href tag. You can pass in all default html attributes like the class tag they will be passed to the rendered html.
You can use a slot as visualisation for the link, the defaults are configured in the default-text parameter from the config.

The attributes for x-smart-download

src

Specify the source of your download file with src, this can be a https path, or a location on your server ( like /mnt/images ) or a Laravel disk to unlock serving images from S3, Dropbox or other custom filesystem.

data-disk

With this data-disk attribute you tell smart on which Laravel disk the src specified can be found.

Examples

A base example

This example lets you download a manual that is stored in your storage path.

An advanced example with an image as visualisation

This example combines the image and the download tag, the image is passed in the default slot so you have a visual link.

A rendered output example

This is the rendered output from an example as above, combining the smart-download and smart-image tag

Schermafbeelding 2021-12-11 om 14 05 07

Smart div

With smart div it's possible to apply background images on div's. The images can be stored everywhere, just like with smart-image. The documentation for smart div is the same as for smart-image. The only difference is that it will render a div with a background-image applied to it.

This renders as the following html

Some storytelling on use cases

resize advanced downloads downloadssmart

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of smart with dependencies

PHP Build Version
Package Version
Requires php Version ~7.2|~8
ext-dom Version *
ext-fileinfo Version *
illuminate/filesystem Version ^7|^8|^9|^10.0|^11.0
illuminate/support Version ^7|^8|^9|^9|^10.0|^11.0
intervention/image Version ^2.6|^3.4
intervention/imagecache Version ^2.5
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 dietercoopman/smart contains the following files

Loading the files please wait ....