Download the PHP package tarsana/syntax without Composer

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

Tarsana Syntax

Build Status Coverage Status SensioLabsInsight Software License

A tool to encode and decode strings based on flexible and composable syntax definitions.

Table of Contents

Quick Example

Warning: This is just a teaser so if the code seems confusing don't worry, you will understand it after reading the Step by Step Guide.

Let's assume that you have the following text representing a list of developers where each line follow the syntax:

Syntax helps you to parse this document and convert it to manipulable objects easily.

Let's do it:

$developers will contain the following:

You modified $developers and want to save it back to the document following the same syntax ? You can do it:

Installation

Install it using composer

Step by Step Guide

The class Tarsana\Syntax\Factory provides useful static methods to create syntaxes. In this guide, we will start with the basics then show how to use SyntaxSyntax to do things faster.

Parsing and Dumping Strings

Parsing and Dumping Numbers

Parsing and Dumping Booleans

Parsing and Dumping Arrays

Tarsana\Syntax\ArraySyntax represents an array of elements having the same syntax and separated by the same string. So an ArraySyntax is constructed using a Syntax (could be NumberSyntax, StringSyntax or any other) and a separator.

Parsing and Dumping Optional Syntaxes

Tarsana\Syntax\Optional represents an optional syntax. Given a syntax and a static default value; it will try to parse inputs using the syntax and return the default value when in case of failure.

Parsing and Dumping Objects

Tarsana\Syntax\ObjectSyntax represents an object in which every field can have its own syntax. It's defined by providing an associative array of fields and a separator (if missing, the separator by default is ':').

Parsing and Dumping Syntaxes

Now you know how to parse and dump basic types : string, boolean, number, array, optional and object. But you may notice that writing code for complex syntaxes (object including arrays including objects ...) requires many complex lines of code. SyntaxSyntax was introduced to solve this issue. As the name shows, it's a Syntax that parses and dumps syntaxes, a meta syntax!

So instead of writing this:

You simply write this

Rules

Examples

Development Notes & Next Steps

Contributing

Please take a look at the code and see how other syntax classes are done and tested before fixing or creating a syntax. All feedbacks and pull requests are welcome :D


All versions of syntax with dependencies

PHP Build Version
Package Version
Requires php Version ^7.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 tarsana/syntax contains the following files

Loading the files please wait ....