Download the PHP package rotexsoft/leanorm-cli without Composer

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

Run PHP Tests and Code Quality Tools   GitHub release (latest SemVer)   GitHub   Coverage Status   GitHub code size in bytes   Packagist Downloads   GitHub top language   Packagist PHP Version Support   GitHub commits since latest release (by date)   GitHub last commit   GitHub Release Date  

Libraries.io dependency status for GitHub repo

LeanOrm Cli

About

This is a simple command line tool for creating LeanOrm Collection, Model & Record classes for each table & view in a specified database. This tool reads information about tables and views from the db & uses that information to generate the desired earlier mentioned classes.

Installation

composer require --dev rotexsoft/leanorm-cli

Usage

php ./vendor/bin/generate-leanorm-classes.php /path/to/config.php

php ./vendor/bin/generate-leanorm-classes.php /path/to/config.php table_or_view_name

You need to create a config file that will be passed to the command above. This config file must return an array with the minimum structure below:

See sample-config.php for the full structure of the array that should be returned by the config file. Each item in the sample config file is thoroughly described & you can specify the ones you want in your own config file.

Note: running the command multiple times will not lead to all previously generated classes being overwritten. The only files that get overwritten would be the ones ending with FieldsMetadata.php. If you want all classes to be regenerated, you would have to manually delete them before re-running the command.

Note: when you modify table or view columns in your database and you have previously generated your classes using a config whose store_table_col_metadata_array_in_file entry has a value of true, you SHOULD re-run this tool with the same config to update all the table column metadata files (i.e. those ending with FieldsMetadata.php) so that your table / view column modifications are reflected in your application. This re-run will not modify your Model, Record & collection class files.

The classes generated will have the directory structure below for a database with an authors table & a posts table:

Most of these classes will be empty, and are provided so you can extend their behavior if you wish. They also serve to assist IDEs with autocompletion of some typehints.

Custom Templates

You can override the templates used by this tool and provide your own instead. This lets you customize the code generation; for example, to add your own common methods or to extend intercessory classes.

The templates used by this tool are located here, you can look at them to have an idea of how to craft your custom templates. Your custom templates can be located in any directory / folder of your choosing but they must have the same names as the default template files, i.e:

You do not have to override all the template files, you can just override the ones you want to customize, the ones you do not override will keep using the default template(s). For example, you may only want to override the Model template TypesModel.php.tpl, which will lead to the default Collection & Record templates to continue being used for creating Collection & Record classes, while your custom Model template would be used for creating Model classes.

You will need to specify the directory containing your custom template files in the config file earlier described by adding an item with the key custom_templates_directory like so:

Below is a full list of variables / tokens that are present in the template files:

Contributing

Running Tests

To run the tests in this package, just run the command below:

composer test

By default, the tests run against an in-memory sqlite database using PDO.

To change the tests to run against another database engine such as mysql, run the command below:

composer gen-test-pdo-config

Then go and edit ./tests/pdo.php with the PDO arguments for the database you want to connect to.

Note that you only need to point to a database that has been created. You don't have to create the tables and views needed for testing, they will automatically be created when the test suite is run. In fact make sure there are no views or tables in the configured database. Also make sure the username you specified (for non-sqlite DBs) has permission to create and drop tables and view.

Because of the way the test-suite is designed, in-memory sqlite does not work. The sqlite db must be stored in a file. This is already setup in the default pdo config.

The package should work with MS Sqlserver, but the tests will only run with sqlite, mysql & postgres databases.

Branching

These are the branches in this repository:


All versions of leanorm-cli with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
atlas/info Version ^1.2.0
rotexsoft/sqlschema Version ^3.1.1
icanboogie/inflector Version ^v3.0.0
symfony/polyfill-php82 Version ^1.26
symfony/polyfill-php83 Version ^1.29
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 rotexsoft/leanorm-cli contains the following files

Loading the files please wait ....