PHPackages                             pyntax/pyntax - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. pyntax/pyntax

ActiveLibrary[Database &amp; ORM](/categories/database)

pyntax/pyntax
=============

Pyntax Framework is a ORM under construction.

0.9.4(10y ago)142MITJavaScript

Since Aug 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SahilDude89ss/PyntaxFramework)[ Packagist](https://packagist.org/packages/pyntax/pyntax)[ Docs](http://github.com/SahilDude89ss/PyntaxFormBuilder)[ RSS](/packages/pyntax-pyntax/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (9)Used By (0)

\#PyntaxFramework Everything you need for development. [Documentation](http://framework.pyntax.net/docs/)

Installation
------------

[](#installation)

### Server Requirements

[](#server-requirements)

The Pyntax framework requires php version &gt; 5.4.31.

### Installing PyntaxFramework

[](#installing-pyntaxframework)

Pyntax utilizes Composer to manage is dependencies. So, before using PyntaxFramework, make sure you have Composer installed on your machine.

```
composer require pyntax/pyntax
composer install

```

Configuration
-------------

[](#configuration)

### Basic Configuration

[](#basic-configuration)

All of the configuration files for the Pyntax framework are stored in the config folder.

Bootloader
----------

[](#bootloader)

The following code is need to be added to the bootloader of the application. We need to specify the folder from which the config is suppose to be loaded.

```
\Pyntax\Pyntax::start(dirname(__FILE__)."/config");

```

Configure Database
------------------

[](#configure-database)

Edit confing/config.php to add database details.

```
Pyntax\Config\Config::write('database', array(
    'server' => 'localhost',
    'user' => 'root',
    'password' => '',
    'database' => 'simplemanager_db_v3'
));

```

Create a Bean
-------------

[](#create-a-bean)

In order to save or retrieve data from the database, we need to create a BEAN.

```
$bean = \Pyntax\Pyntax::getBean('');

```

### Save a Bean

[](#save-a-bean)

Once the bean is retrieved, the new value can be set by using the following method. Once all the required data has been set, save() function is called to save the data in the database. When saving a new Bean save function will return id of the new Record, when updating it will return a boolean value.

```
$bean-> = 4;
$id = $bean->save();

```

Find a Bean
-----------

[](#find-a-bean)

Once an empty bean is retrieved it can be used to search for data in the database.

```
$bean = \Pyntax\Pyntax::getBean('');
$bean->find(1);

```

This will load the data for record with primary key id 1 into the same bean.

### Finding a Bean with AND and OR

[](#finding-a-bean-with-and-and-or)

A Bean can be used to search for data using an Array. The following is an example of using AND and OR at the same time.

```
$clientBean->find(array('AND' => array(
    'first_name' => 'Sahil',
    'OR' => array(
        'last_name' => 'Sharma',
        'email' => 'SahilSHARM'
    )
)));

```

The above code will generate the following query:

```
SELECT
    *
FROM
    clients
WHERE
    first_name = 'Sahil' AND last_name = 'Sharma' OR email = 'SahilSHARM'";

```

If the search results returns more than one bean, it will return an array with the associated bean or if the search returns only return one record it will return the object and also can be accessed from the base bean.

Generate a Form using a FormFactory and a Bean
----------------------------------------------

[](#generate-a-form-using-a-formfactory-and-a-bean)

A Bean can be used to generate a form which can be used to save and update bean in the database.

```
/**
 * This has to be added in the bootloader so the POST request can
 * grabbed and the data can be saved to the database.
 */
\Pyntax\Pyntax::run();

//Load the bean
$attachmentBean = \Pyntax\Pyntax::getBean('attachments');

//Generate the form
echo \Pyntax\Pyntax::generateForm($attachmentBean);

```

### Config for Forms

[](#config-for-forms)

```
Pyntax\Config\Config::write('form', array(
    /**
     * @property: capturePostAndSaveBean
     * This allows the bean to be saved into the database when a form is submitted.
     */
    'capturePostAndSaveBean' => true,

    /**
     * @property: callback_before_capturePostAndSaveBean
     * This callback function can be used to inject more data like the users_id of the User who is logged in.
     */
    'callback_before_capturePostAndSaveBean' => function(array $data) {

    },

    /**
     * @property: callback_after_capturePostAndSaveBean
     */
    'callback_after_capturePostAndSaveBean' => function(\Pyntax\DAO\Bean\BeanInterface $bean, $id) {
        /**
         * @ToDo: If any things has to be done after save.
         */
    },

    /**
     * @property: showLabels
     * This is a  flag used to display the labels when a form is rendered
     */
    'showLabels' => true,

    /**
     * @property: convertColumnNamesIntoLabel
     * This allows the labels on the field to be formatted automatically depending on the field name. It removes
     * any "_" and "-" with a space and makes all the first alphabets of the words upper case.
     */
    'convertColumnNamesIntoLabel' => true,

    /**
     * @property: submitButton
     * This defines the template for Submit button that will be rendered in a form.
     * A Custom button can be defined in the beans key in the config array.
     *
     * -  will be replicated with the table name in the Bean
     */
    'submitButton' => array(
        'tagName' => 'button',
        'attributes' => array(
            'type' => 'submit'
        ),
        'value' => 'Save'
    ),

    /**
     * @property: beans
     * This keys stores custom config for forms for particular beans.
     */
    'beans' => array(),

    /**
     * @property: formTemplate
     * This defines a default form tag with the defaults attributes
     */
    'formTemplate' => array(
        'tagName' => 'form',
        'attributes' => array(
            'method' => 'post',
            'class' => 'form-horizontal'
        )
    ),

    /**
     * @property: labelTempalte
     * This defines a default label tag with the default attributes
     */
    'labelTemplate' => array(
        'tagName' => 'label',
    ),

    /**
     * Defining callback functions on element rendering
     * Components in a Form:
     * 1. All the html elements
     * 2. Html element containers.
     *
     * Defining a container
     * 1. _container
     */
    'label_container' => array(
        'tagName' => 'div',
        'attributes' => array(
            'class' => 'col-sm-2 control-label'
        )
    ),
    'element_container' => array(
        'tagName' => 'div',
        'attributes' => array(
            'class' => 'col-sm-10'
        )
    ),
    'form_column' => array(
        'nbr_of_columns' => 2,
        'column_element_template' => array(
            'tagName' => ' div',
            'attributes' => array(
                'class' => 'row'
            )
        ),
        'container_element_template' => array(
            'tagName' => 'div',
            'attributes' => array(
                'class' => 'col-md-6'
            )
        ),

    ),
    'form_element_container_template' => array(
        'templateName' => 'html_element_template',
        'data' => array(
            'tagName' => 'div',
            'attributes' => array(
                'class' => 'form-group'
            )
        ),
    )
));

```

The Form generator will automatically remove the primary fields. The above config array is used to set all the HTML properties of the form. The form will look as follows:

```

           File Name

           File Path

           Date Uploaded

           File Type

    Save

```

Generate a Table using TableFactory and a Bean
----------------------------------------------

[](#generate-a-table-using-tablefactory-and-a-bean)

A bean and a find query can be used to generate a table. PyntaxDAO, for now automatically finds the fields which are eligible for displaying. It removes all id fields and only keep string fields.

```
$clientBean = \Pyntax\Pyntax::getBean('clients');

$tableFactory = new Pyntax\Table\TableFactory;
$tableFactory->generateTable($clientBean, array('AND' => array(
    'first_name' => 'Sahil',
    'OR' => array(
        'last_name' => 'Sharma'
    )
)));

```

### Config for Tables

[](#config-for-tables)

```
Pyntax\Config\Config::write('table', array(
    /**
     * @property: recordLimitOnOnePage
     * This stores the number for records which are displayed on each.
     * @ToDo: This would be implemented as the size of the Pagination
     */
    'recordLimitOnOnePage' => 10,

    /**
     * @property: table
     * This stores all the default attributes for the table tag.
     * @ToDo: There can attributes which can be passed while calling generateTable
     */
    'table' => array(
        'class' => 'table table-bordered table-hover',
        'id' => 'example2'
    ),

    /**
     * @property: tableHeader
     * This stores a boolean value whether the table header has to be printed or not.
     */
    'tableHeader' => true,

    /**
     * @property: beans
     * This array key is used to override any configuration based on the bean we are loading.
     */
    'beans' => array(
        'accounts' => array(
            'recordLimitOnOnePage' => 15,
        )
    )
));

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Total

5

Last Release

3730d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/26b459bf15b816eca2616b4d2cda745a563ef2f097151bb97366b5c537483e15?d=identicon)[SahilDude89ss@gmail.com](/maintainers/SahilDude89ss@gmail.com)

---

Top Contributors

[![SahilDude89ss](https://avatars.githubusercontent.com/u/9151763?v=4)](https://github.com/SahilDude89ss "SahilDude89ss (47 commits)")

---

Tags

ormform-builderdaohtml-generator

### Embed Badge

![Health badge](/badges/pyntax-pyntax/health.svg)

```
[![Health](https://phpackages.com/badges/pyntax-pyntax/health.svg)](https://phpackages.com/packages/pyntax-pyntax)
```

###  Alternatives

[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[thecodingmachine/tdbm

The Database Machine is a PHP ORM that requires no configuration. The object model is deduced from the database model.

123174.9k6](/packages/thecodingmachine-tdbm)[openbuildings/jam

Small but feature rich ORM, has extensible models and builders, baked in upload functionality, supporting multiple backends (rackspace, ftp), polymorphic associations, form builders, nested forms, validators

32181.3k16](/packages/openbuildings-jam)[kassko/data-mapper

A mapper which gives a lot of features to representate some raw data like objects

1338.5k1](/packages/kassko-data-mapper)[data-dog/pager-bundle

Paginator bundle for symfony2 and doctrine orm, allows customization with filters and sorters

11103.5k7](/packages/data-dog-pager-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
