Download the PHP package serj/sortable without Composer

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

Sortable - Yii2 component to maintain sort column in relational database table.

Installation

To import the component to your project, put the following line to the require section of your composer.json file:

or run the command

Config

Let's assume a table of the following structure:

cartoons

When you want to query items in the sorted order, you must assume that items with lower sort values go first (ASC).

To initialize component via app config, with minimal required settings

Let's look at more interesting scenario. Our table has 2 columns to maintain items order. sort_inner - for sorting in bounds of a category, sort_general - for sorting through out the entire table.

To maintain both columns we need two instances of the component, each one for its respective column.

Or if you want to use it directly without config

Usage

To get sort value for an item to be inserted after id:5

To get sort value for an item to be inserted before id:5

Then, if you use ActiveRecord, you may insert a new record like this

To get sort value for an item to be inserted before all items

To get sort value for an item to be inserted after all items (in terms of specific category)

If you created a new category, say category_id:17 and there are no items yet

If you table have a column or columns representing a state of a record (e.g. deleted, archived) which means you no longer use those records, or you just what to ignore them, you can specify it in the config as skipRows. In this particular case those are archived, color.

Thus, all tuples that have archived = true and color = false wont be taken in account. There is a gotcha: these states must be persistent, so once set they must not be reverted back. If you switch it back and forth, then do not use this option.

Alternative database connection

By default the component uses \Yii::$app->db, if you have to use another connection

Or set it up in the component config

Using with MySql database (by default it's Postgres)


All versions of sortable with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
yiisoft/yii2 Version ~2.0.6
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 serj/sortable contains the following files

Loading the files please wait ....