Download the PHP package shso/laravel-cassandra without Composer

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

Lacassa

Build Status codecov

WORKING ON A NEW VERSION WAIT FOR DOCUMENTATION UPDATES

A Query builder with support for Cassandra, using the original Laravel API. This library extends the original Laravel classes, so it uses exactly the same methods.

Table of contents

Installation

Make sure you have the DataStax PHP Driver for Apache Cassandra installed. You can find installation instructions at datastax repo.

Note: datastax php-driver works with php version 5.6.*, 7.0.* and 7.1.* only

Installation using composer

And add the service provider in config/app.php:

Configuration

Change your default database connection name in config/database.php:

And add a new cassandra connection:

Note: you can enter all of your nodes like:

# .env
DB_HOST=192.168.100.140,192.168.100.141,192.168.100.142

Note: you can choose one of the consistency levels below:

any three local_qourum local_one
one qourum each_qourum serial
two all local_serial

Query Builder

The database driver plugs right into the original query builder. When using cassandra connections, you will be able to build fluent queries to perform database operations.

If you did not change your default database connection, you will need to specify it on each query.

Examples

Retrieving All Records

Indexing columns

CREATE INDEX creates a new index on the given table for the named column.

Selecting columns

Wheres

The WHERE clause specifies which rows to query. In the WHERE clause, refer to a column using the actual name, not an alias. Columns in the WHERE clause need to meet one of these requirements:

And Statements

Using Where In With An Array

Order By

ORDER BY clauses can select a single column only. Ordering can be done in ascending or descending order, default ascending, and specified with the ASC or DESC keywords. In the ORDER BY clause, refer to a column using the actual name, not the aliases.

Limit

We can use limit() and take() for limiting the query.

Distinct

Distinct requires a primary key field for which to return the distinct values.

Distinct can be combined with where:

Count

Count can be combined with where:

Truncate

Filtering a collection set, list, or map

You can index the collection column, and then use the CONTAINS condition in the WHERE clause to filter the data for a particular value in the collection.

After indexing the collection keys in the venues map, you can filter on map keys.

Raw Query

The CQL expressions can be injected directly into the query.

Inserts, updates and deletes

Inserting, updating and deleting records works just like the original QB.

Insert

Updating

To update a model, you may retrieve it, change an attribute, and use the update method.

Updating a collection set, list, and map

Update collections in a row. The method will be like

Collection_type is any of set, list or map.

Column_name is the name of column to be updated.

Operator is + or -, + for adding the values to collection and - to remove the value from collection.

Value can be associative array for map type and array of string/number for list and set types.

Deleting

To delete a model, simply call the delete method on the instance. We can delete the rows in a table by using deleteRow method:

We can also perform delete by the column in a table using deleteColumn method:

Testing

I have created a docker container which has php7.0 and cassandra php driver installed. It is prefered to use docker for testing purposes.

Also there is a run executable which is there to ease use of docker container. It checks everything and makes sure all dependancies and the cassandra server are up and running and then passes your command to the container.


All versions of laravel-cassandra with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6 || ^7.0 || ^7.1
ext-cassandra Version ^1.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 shso/laravel-cassandra contains the following files

Loading the files please wait ....