Download the PHP package grayphp/micro without Composer

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

PHP Micro Framework

Think big, code small with Micro - the PHP micro framework for web applications.

Installation

Install via composer

Usage/Examples

Abailable Routes:

Route

Middleware

Dynamic Route

controller

Make controller

Middleware

Make Middleware

Database

Your can access to Database using DB() helper.

Basic CRUD:

You can interact directly with the tables to insert/update/delete/select data:

Use ArrayAccess interface to access to the data using the id:

DB instance

Select by other fields

If you want to select a row by other key than id, just use the method get:

Select or create

Sometimes, you want to get a row or create it if it does not exist. You can do it easily with getOrCreate method:

Rows

A Row object represents a database row and is used to read and modify its data:

Queries

A Query object represents a database query. SimpleCrud uses magic methods to create queries. For example $db->post->select() returns a new instance of a Select query in the tabe post. Other examples: $db->comment->update(), $db->category->delete(), etc... Each query has modifiers like orderBy(), limit():

The method get() executes the query and returns the processed result of the query. For example, with insert() returns the id of the new row:

select()->get() returns an instance of RowCollection with the result:

If you only need the first row, use the modifier one():

select() has some interesting modifiers like relatedWith() to add automatically the WHERE clauses needed to select data related with other row or rowCollection:

Query API:

Queries use Atlas.Query library to build the final queries, so you can see the documentation for all available options.

Select / SelectAggregate

Function Description
one Select 1 result.
relatedWith(Row / RowCollection / Table $relation) To select rows related with other rows or tables (relation added in WHERE).
joinRelation(Table $table) To add a related table as LEFT JOIN.
getPageInfo() Returns the info of the pagination.
from Atlas.Query Select()
columns Atlas.Query Select()
join Atlas.Query Select()
catJoin Atlas.Query Select()
groupBy Atlas.Query Select()
having Atlas.Query Select()
orHaving Atlas.Query Select()
orderBy Atlas.Query Select()
catHaving Atlas.Query Select()
where Atlas.Query Select()
whereSprintf Atlas.Query Select()
catWhere Atlas.Query Select()
orWhere Atlas.Query Select()
orWhereSprintf Atlas.Query Select()
whereEquals Atlas.Query Select()
limit Atlas.Query Select()
offset Atlas.Query Select()
distinct Atlas.Query Select()
forUpdate Atlas.Query Select()
setFlag Atlas.Query Select()
bindValue Atlas.Query Select()

Update

Function Description
relatedWith(Row / RowCollection / Table $relation) To update rows related with other rows or tables (relation added in WHERE).
set Atlas.Query Update()
setFlag Atlas.Query Update()
where Atlas.Query Update()
orWhere Atlas.Query Update()
catWhere Atlas.Query Update()
orderBy Atlas.Query Update()
limit Atlas.Query Update()
offset Atlas.Query Update()

Insert

Function Description
orIgnore() To ignore silently the insertion on duplicated keys, instead throw an exception.
set Atlas.Query Insert()
setFlag Atlas.Query Insert()

Delete

Function Description
relatedWith(Row / RowCollection / Table $relation) To delete rows related with other rows or tables (relation added in WHERE).
setFlag Atlas.Query Delete()
where Atlas.Query Delete()
orWhere Atlas.Query Delete()
catWhere Atlas.Query Delete()
orderBy Atlas.Query Delete()
limit Atlas.Query Delete()
offset Atlas.Query Delete()

Lazy loads

Both Row and RowCollection can load automatically other related rows. Just use a property named as related table. For example:

This allows make things like this:

Use magic methods to get a Select query returning related rows:

Solving the n+1 problem

The n+1 problem can be solved in the following way:

You can perform the select by yourself to include modifiers:

For many-to-many relations, you need to do one more step:

Relate and unrelate data

To save related rows in the database, you need to do this:

Pagination

The select query has a special modifier to paginate the results:


All versions of micro with dependencies

PHP Build Version
Package Version
Requires simple-crud/simple-crud Version ^7.5
ext-mbstring Version *
ext-openssl Version *
vlucas/phpdotenv Version ^5.5
phpmailer/phpmailer Version ^6.6
nesbot/carbon Version ^2.62.1
psr/simple-cache Version ^1.0|^2.0|^3.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 grayphp/micro contains the following files

Loading the files please wait ....