Download the PHP package jlucki/spark without Composer

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

Spark Object Document Mapper

GitHub license Code coverage

Spark ODM is currently in its infancy and may not be suitable for all applications. Please consider your use case carefully before deploying it to any critical systems.

Test Drive DynamoDB

If you're looking for an easy, model driven way to get started with DynamoDB, look no further. This ODM comes equipped with Docker configuration files. Download the library and run docker-compose up to spin up a local development environment, including a local instance of DynamoDB.

Once the containers are running, simply visit localhost in your browser. Refresh a couple of times to get additional example blog entries. Have a look at public/index.php to see what's happening under the hood.

You can also download the NoSQL Workbench from AWS, to easily browse your DynamoDB data. Once installed, open the workbench, click on Operation builder on the left hand side menu. Click on + Add connection, switch to DynamoDB local, give the connection a name, leave the port on 8000, and click on Connect.

Requirements

This library only works with PHP 8.0 and up.

Documentation

Spark is a PHP ODM library for use with Amazon DynamoDB.

How to install using Composer:

How to create a Spark connection:

If you're using Symfony, you can make use of Symfony's autowiring and add Spark to your service's constructor.

Otherwise, you can simply create a new Spark class, passing in the required credentials.

Tip: You can use an empty string for the id and secret for local development.

How to create a data model:

See Article.php for an example table/item data model.

How to create a global secondary index:

To create a GSI on your table add the GlobalSecondaryIndex attribute to the property. The GSI name will default to the value of AttributeName. Alternatively, you can assign a custom name by passing a string into the GSI attribute GlobalSecondaryIndex('customName').

Note: You must provide a custom name for a GSI if the GSI has both HASH and RANGE keys, otherwise the two keys will not be recognised as a single GSI. See example below.

The default projection type is KEYS_ONLY. To change the projection type add the ProjectionType attribute to the property, and pass in one of the following values: ProjectionType::KEYS_ONLY, ProjectionType::INCLUDE, or ProjectionType::ALL.

When using ProjectionType::INCLUDE, you will also have to add the NonKeyAttributes attribute to the property, and pass in an array that contains the names of any attributes you want to project into the index. For example: NonKeyAttributes(['title', 'content'])

How to create a table:

How to get or check if a table exists:

How to update a table:

The updateTable() method will compare the described table schema as provided by DynamoDB to your local file schema, and compute any required changes. The updateTable() method supports:

Tip: You can add open attributes to your model without running the updateTable() method. This data will be automatically added to your table next time you put or update the item.

How to delete a table:

Warning: This will also delete all items in the table. This cannot be undone.

How to put a new item into the database:

How to get an item from the database:

How to get an item from the database using a secondary index:

You cannot use getItem() to retrieve an item from DynamoDB using a secondary index. This is because a secondary index's hash and range keys are not unique. You can however, query the table using the secondary index, and get the first result. See here for more details.

How to update an item in the database:

How to delete an item from the database:

How to scan the whole table:

How to query specific items:

Tip: findBy() only works on table index attributes. You can use filterBy(), also passing in an Expression object, to additionally filter by other attributes.

Tip: You can also return the raw AWS\Result with getRaw() or return all details, including the LastEvaluatedKey in an easy to use object with getHeap().

How to query specific items using a secondary index:

Tip: If you're expecting a single item result with your query, you can use getFirst() instead of getItems(). This will return the first ItemInterface object from your results, or null if nothing is found.

How to get a count of your queried items:

How to query the DynamoDbClient directly:

The scope of the ODM doesn't cover the entire AWS SDK for PHP for DynamoDB. You can access the DynamoDbClient and all its methods, and run your own custom queries, with the method below.


All versions of spark with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
aws/aws-sdk-php Version ^3.166
symfony/http-foundation Version ^5.2
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 jlucki/spark contains the following files

Loading the files please wait ....