Download the PHP package peekandpoke/slumber without Composer

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

Code Coverage Scrutinizer Code Quality Build Status

Slumber

What is Slumber? It is a tool for mapping data from objects to arrays and vice versa.

It gives you the possibility to easily map your domain model to JSON. Or to map from JSON to your domain model classes.

Slumber uses Doctrine Annotations. The annotations are used to mark which properties of your classes are to be mapped and in which way.

(PHP5.6 compatibility until v0.4.x)

Basic example

The "trademark" of the slumber annotated classes are annotations like these:

might output the following:

Getting started

Array codec example

In order to get the ArrayCodec into our hands we have to set it up:

Mapping

In order to fully control serialization and de-serialization there is a set of annotations that can be used.

Mapping scalars

You will find the implementation of all mappers here

Slumber\AsBool()

Maps values from and to booleans.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Slumber\AsDecimal()

Maps values from and to floating point values.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Slumber\AsInteger()

Maps values from and to floating point values.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Slumber\AsIs()

Maps values from and to as they are.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Slumber\AsString()

Maps values from and to floating point values.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Mapping Nested Objects

Slumber\AsObject()

Maps from and to nested objects.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Slumber\AsEnum()

Maps values from and to enum values.

For this to work we need an Enum class. For details on the Enums have a look at here.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Mapping Collections, Lists, KeyValue-Pairs

Slumber\AsList()

Maps values from and to lists (arrays without indexes).

The annotations expects a nested annotation that controls the shape of the elements within the collection.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Similarly one would map to a list of objects:

Slumber\AsMap()

Maps values from and to KeyValue-Pairs (arrays with indexes).

The annotations expects a nested annotation that controls the shape of the elements within the collection.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Similarly one would map to a list of objects:

Slumber\AsKeyValuePairs()

Maps values from and to special shaped KeyValue-Pairs. This can be useful in terms of database indexing.

The annotations expects a nested annotation that controls the shape of the elements within the collection.

maps to

maps to

The same behaviour applys for the opposite direction. For more details on how the mapper works have a look here

Similarly one would map to a list of objects:

Polymorphism example

When serializing the polymorphism information is not needed. Since we know exactly which class we have in our hand to serialize.

But while de-serialization polymorphism needs to be annotated explicitly. Only by doing this we can know which classes to instantiate. We also need a field in the data, which acts as the discriminator.

TICKETS:

next ticket number: 14

PRIO I

SLUMBER-13 - 0%
( ) unit test for polymorphics that fall back to the default
( ) a) discriminator no set
( ) b) unknown discriminator set

SLUMBER-12 - 50% - Implement aliases class for repositories -> in order to store multiple type in one collection we must be able to specify alias classes for repositories (x) reported 2016-11-15 (x) implemented 2016-11-15 ( ) unit-tests

SLUMBER-4 - 0% - Refactor the hardcoded visitors in the MongoDbCodec set to come from the MongoDbEntityConfig -> the config reader must automatically add the visitors (can user override these somehow?) -> it is more generic and will work fine in conjunction with user-attached listeners
(x) reported 2016-05-01

SLUMBER-7 - 0% -

PRIO II

SLUMBER-3 - 0% - Let visitors like onPreCreate() pass an event class instead of multiple parameters -> better extensibility -> event propagation could be stopped (x) reported 2016-05-01

SLUMBER-2 - 0% - setting and reading of properties through getters and setters first. If not possible use reflection
-> reading and writing of inherited private properties will be possible
-> +33% speed
(x) reported 2016-05-01

SLUMBER-8 - 0% - implement GeoJSON support for Data\MongoDB
-> implement GeoSpatialIndex for GeoJson types -> implement GeoJsonPolygon, GeoJsonMultiPolygon and other GeoJson types (x) reported 2016-05-12

SLUMBER-7 - IRepository::save should return a more specific result than @return array|null (x) reported 2016-05-12

PRIO III

SLUMBER-6 - 0% - Make Slumber\Swagger an own package and base it on a generic code generation component -> this is a project of its own -> get rid of gossi/php-code-gen (x) reported 2016-05-01

Completed

SLUMBER-1 - 100% - Remove @AsOne2One annotation and do similar as with @AsId -> currently entities marked like this cannot be used with the ArrayCodec (which is broken behaviour) (x) completed 2016-05-11

SLUMBER-5 - 100% - move Slumber\MongoDb to Slumber\Data\MongoDb -> Slumber\Data will be the home of all database things (x) completed 2016-05-11

SLUMBER-9 - 100% - implement polymorphic slumbering and awaking (x) reported 2016-05-14 (x) completed 2016-10-01 (x) unit-tests

SLUMBER-10 - 100% implement usage of collection classes for all AsCollection mappings -> This will make it possible to wrap incoming arrays into Collection classes. -> This will increase convenience for operations on array since the code will be encapsulated alongside the data -> Example: a TagsSet collection type which contains tags, could have methods like has(), addUnique(), remove() (x) reported 2016-11-01 (x) completed 2016-11-13 (x) unit-tests

SLUMBER-11 - 100% implement LazyDbRefCollection for storing lists of referenced objects (x) reported 2016-11-13 (x) completed 2016-11-13 (x) unit-tests


All versions of slumber with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
psr/log Version ^1.0.2
psr/container Version ^1.0
symfony/finder Version ^3.3.10
peekandpoke/psi Version ^1.0.1
doctrine/common Version ^2.8.1
peekandpoke/php-types Version ~1.2.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 peekandpoke/slumber contains the following files

Loading the files please wait ....