Download the PHP package locomotivemtl/charcoal-attachment without Composer

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

Charcoal Attachment

Attachments add support for working with relationships between models. Also provided are a usable set of basic attachments: Document, Embed, Image, Gallery, Link Video, amongst others.

How to install

The preferred (and only supported) way of installing _charcoal-attachment is with composer:

Dependencies

Objects

Objects in the charcoal-attachments module extends Content, from charcoal-object, which is an AbstractModel, from charcoal-core.

In addition from the default metadata provided by Content, the following properties are default for all Attachment objects:

Standard properties (used by all attachments objects):

Property Type Description
id id A uniqid, for referencing.
title string (l10n)
show_title boolean
categorie object (multiple) | By default, categories arecharcoal/attachment/object/category/generic` objects.
subtitle string (l10n)
description text (l10n)
keywords string (l10n, multiple) Typically used for searching purpose.
type string

Specialized properties which can be used differently, depending on context:

Property Type Description
link string (l10n) URL.
file file (l10n) Uploadable file, or "document".
file_size string The uploaded file size, in bytes (auto-generated).
file_type string The uploaded file mimetype (auto-generated).
thumbnail image (l10n)
embed text (l10n) Typically a video.

All attachments are assumed to have a title, subtitle, description and keywords. Some attachments also

Read the charcoal-object documentation for the other default properties provided by the Content object (and RevisionableInterface).

Read the charcoal-core documention for the other default properties provided by AbstractModel (and DescribableInterface and StorableInterface).

Type of Attachment objects

Widgets

The module provides his own admin widgets namespaced as Charcoal\Admin.

BUT HOW

The setup is fairly easy, but you need to remember a few things in order for it to work.

Configurations

Add the views path and metadata path to the config file.

Then, we need to add the necessary routes for the widgets in admin.json config file.

Usage

You need to make your object(s) "Attachment Aware", so that it knows it can have attachments. To do that, use/implement attachmentAware:

Then, just add in the widget in the edit dashboard or the form like this:

Available attachable objects as provided by the current modile are:

To create a new attachment, you need to extend the base Attachment object charcoal/attachment/object/attachment and provide a "quick" form.

To remove unnecessary join when deleting an object, you need to add this to your object:

Documentation

Attachment widget can be use more than once in a form. In order for it to work properly, you need to define a group ident group different for each instanciated widgets.

In this case, we set the group to "main". If none defined, the default group will be "generic". Without those ident, widgets won't be able to know which attachments are his.

You can than access a perticular "group" attachments calling the object's method "attachments(group_ident)". In this case, $object->attachments('main') will return attachments associated with the widgets that has the group set to "main".

Attachment creation

The one thing you need to know about the attachment is that it is all in a single table. You can't associate custom objects with other objects if they are not attachments.

Then, how could you create new attachments? It all depends on what you want.

Adding or modifying properties

IF you need to add properties to an existing attachment, you can always extend it. Let's say you want to change the editor options for the description field given with the attachments. The first step is to create a new object that will extend the existing one.

Now that we have the extend, let's add to the JSON by creating a my/namespace/text.json file.

In that case, the editor options are changed to remove the base style formats, change the body class and add the appropriate css. The important part is to set the data type to the current object. This is used in live edit and delete features.

If you added some extra properties, you can use the alter script to add them into the table.

vendor/bin/charcoal admin/object/table/alter --obj-type=my/namespace/text

Notes

Don't use "attachments" method directly in mustache template. This will return ALL attachments without considering the group.

Custom templates for the attachment preview in the backend widget is on the to-do list.

Other actions such quick view are on the to-do list as well.

For a complete project example using charcoal-attachment, see the charcoal-project-boilerplate.

Development

To install the development environment:

Run the code checkers and unit tests with:

API documentation

Development dependencies

Continuous Integration

Service Badge Description
Travis Build Status Runs code sniff check and unit tests. Auto-generates API documentaation.
Scrutinizer Scrutinizer Code Quality Code quality checker. Also validates API documentation quality.
Coveralls Coverage Status Unit Tests code coverage.
Sensiolabs SensioLabsInsight Another code quality checker, focused on PHP.

Coding Style

The Charcoal-Attachment module follows the Charcoal coding-style:

Coding style validation / enforcement can be performed with composer phpcs. An auto-fixer is also available with composer phpcbf.

Authors

License

Charcoal is licensed under the MIT license. See LICENSE for details.


All versions of charcoal-attachment with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
locomotivemtl/charcoal-config Version ~0.8
locomotivemtl/charcoal-core Version ~0.4
locomotivemtl/charcoal-object Version ~0.5
locomotivemtl/charcoal-translator Version ~0.3
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 locomotivemtl/charcoal-attachment contains the following files

Loading the files please wait ....