An open API service indexing awesome lists of open source software.

https://github.com/divengine/ways

Div PHP Ways adapts Service-Oriented Architecture (SOA) to PHP apps, seamlessly integrating components in a hybrid system. This class also acts as both an HTTP and CLI router, empowering developers to structure and modularize their applications efficiently.
https://github.com/divengine/ways

flow mvc php routing

Last synced: 10 days ago
JSON representation

Div PHP Ways adapts Service-Oriented Architecture (SOA) to PHP apps, seamlessly integrating components in a hybrid system. This class also acts as both an HTTP and CLI router, empowering developers to structure and modularize their applications efficiently.

Awesome Lists containing this project

README

          

# Div PHP Ways

[![Latest Stable Version](https://poser.pugx.org/divengine/ways/v)](https://packagist.org/packages/divengine/ways) [![Total Downloads](https://poser.pugx.org/divengine/ways/downloads)](https://packagist.org/packages/divengine/ways) [![Latest Unstable Version](https://poser.pugx.org/divengine/ways/v/unstable)](https://packagist.org/packages/divengine/ways) [![License](https://poser.pugx.org/divengine/ways/license)](https://packagist.org/packages/divengine/ways) [![PHP Version Require](https://poser.pugx.org/divengine/ways/require/php)](https://packagist.org/packages/divengine/ways)

A "way" is different to a "route". We need a path for found a specific resource, but we need a way for do something. This library follow this concept when implements the
routing and control of PHP application.

This class redefines the way PHP applications handle routing and control. Unlike traditional routes, Div PHP Ways introduces the concept of "ways" to execute actions dynamically in a modular and flexible manner.

## Key Features

- **Service-Oriented Architecture (SOA):** Adapts SOA principles to PHP applications for enhanced modularity.

- **Hybrid System Integration:** Seamlessly integrates components in a hybrid system, providing a cohesive architecture.

- **HTTP and CLI Routing:** Acts as a robust router for both HTTP and CLI interfaces, offering a unified approach.

Explore the possibilities with Div PHP Ways and elevate your PHP application architecture to new heights!

## Examples

```php
prepare($data['query']);
$st->execute($data['params']);
$data['result'] = $st->fetchAll(PDO::FETCH_OBJ);
return $data;
});

});

ways::invoke('sql://query', [
'query' => 'SELECT * FROM cats WHERE name = ?',
'params' => ['Tom']
]);

```

On other platforms it is common to define all routes to
the drivers in the same file and once. In Ways this
is not an obligation. You can have an initial control
point and depending on the URI invoked go to another
control point X where routes are defined, so that the
path is formed on demand, thus improving performance
of its application. The structure of a URI may suggest
that Ways allows a hierarchical structure of control points,
but it does not, it can create a whole graph structure.

A first URI is invoked, from HTTP or CLI. But inside your code
you can invoke any URIs

![div ways MVC](https://github.com/divengine/resources/raw/master/div-ways/cards/div-ways-mvc-sample.png)

In addition to this, a control point may require the
previous execution of another control point. You can also
implement events or hooks, so you can execute one control
point before or after another, without the latter knowing
the existence of the first. These flexibilities are valid
for example in a plugins architecture.

The control points can interact, and this means, redirect
the flow to another, call control points directly, exchange
data and url arguments, handle the output on screen, etc.

In addition, you can establish rules for the execution of
control points.

```php
['is-monday']]);

```

Ways is not only intended for the web but also for
command line applications. Ways is implemented in a
single class, in a single file. This allows quick start-up
and easy adaptation with other platforms.

## Documentation

Visit https://divengine.org

## Installation

With composer...

```bash
composer require divengine/ways
```

Without composer, download the class and...

```php
include "path/to/divengine/ways.php";
```

## Basic usage

```php
$property,
]);

```

Enjoy!

--

@rafageist

Eng. Rafa Rodriguez

https://rafageist.com