Download the PHP package asgard/behaviors without Composer

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

Behaviors

Build Status

The Behaviors package provides some behaviors ready to use out-of-the-box for your entities. This page defines what the usage, the properties, the hooks and the methods brought by the behavior.

Installation

If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.

composer require asgard/behaviors 0.*

MetasBehavior

Usage

In your entity definition:

$definition->behaviors = [
    new \Asgard\Behaviors\MetasBehavior
];

Properties

meta_title:
    type: text
    required: false
meta_description:
    type: text
    required: false
meta_keywords:
    type: text
    required: false

Methods

$entity->showMetas();

outputs the entity metas in the html

PublishBehavior

Usage

In your entity definition:

$definition->behaviors = [
    new \Asgard\Behaviors\PublishBehavior
];

Properties

published:
    type: boolean
    default: true

Methods

Entity::published();

returns an orm with a published entities scope.

Entity::loadPublished($id);

returns an entity from a given id only if the entity is published.

SlugifyBehavior

Usage

In your entity definition:

$definition->behaviors = [
    new \Asgard\Behaviors\SlugifyBehavior
];

This will use the first entity property as a slug.

To use a speficic property as slug:

$definition->behaviors = [
    new \Asgard\Behaviors\SlugifyBehavior('title')
];

Properties

slug:
    type: text
    required: false

Methods

$entity->slug();

returns the entity slug

SortableBehavior

Usage

In your entity definition:

$definition->behaviors = [
    new \Asgard\Behaviors\SortableBehavior
];

Properties

position:
    type: integer
    required: false
    default: 0
    editable: false

Hooks

If the position is not set, when saving the entity, the position will be incremented from the last entity.

Methods

$entity->moveAfter($anotherEntityId);

moves the entity after another entity with a given id

$entity->previous();

returns the entity before the current one.

$entity->next();

returns the entity after the current one.

TimestampsBehavior

Usage

In your entity definition:

$definition->behaviors = [
    new \Asgard\Behaviors\TimestampsBehavior
];

Properties

created_at:
    type: datetime
    required: false
    default: function() { return \Asgard\Common\Datetime::now(); }
    editable: false
updated_at:
    type: datetime
    required: false
    default: function() { return \Asgard\Common\Datetime::now(); }
    editable: false

Hooks

Upon saving an entity, the updated_at property will be updated with the current date and time.

Contributing

Please submit all issues and pull requests to the asgardphp/asgard repository.

License

The Asgard framework is open-sourced software licensed under the MIT license


All versions of behaviors with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
asgard/entity Version ~0.3.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 asgard/behaviors contains the following files

Loading the files please wait ...