Download the PHP package pixelcone/fraction without Composer

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

Fraction

Fraction is a set of abstractions offering PHP devs a convenient way of storing a business logic in their apps.

The idea for this package was born during the process of refactoring a large project written in Laravel. This package was inspired by many different works (packages, articles) of other authors. Here are some of them:

Prerequisites

Before you begin, ensure you have met the following requirements:

There are really no any other requirements. The package is Laravel-friendly, so if you install it into a Laravel project, you will be able to use dependency injection within the handle() method of your Actions/Features (more of them down below).

Installing Fraction

To install Fraction, run the composer require command:

Using Fraction

This package introduces two abstract layers: Actions and Features.

Actions

Actions are basic "Units of Life" of the entire application. In a nutshell, Actions are regular PHP classes, focusing on performing one specific task only (for example, saving a user into DB or sending an email). Actions can accept different parameters via constructor and can be called from anywhere in the code (preferably from Applications or within the same Domain only, though). It is highly recommended to have only one public method in each action class to help developers avoid the temptation of polluting it with extra logic. A name of the Action should reflect what it actually does by answering the question "what should it do?". Actions are parts of Domains, residing in their own Actions folder. Actions can also be used as Laravel Jobs.

An example of an Action class and its usage:

Thanks to the Pixelcone\Fraction\AsAction trait, this Action class can be now called like this:

We've just instantiated the Action class and run a handle() method using a single expression!

Features

Features have a lot in common with Actions: they're regular PHP classes too, they accept different params through constructor, and they also can have one custom public handle method. They have different purpose, though: they act as an intermediate layer between controllers/commands and actions. It is a fairly common case when controller or command methods get bigger over time, making it more difficult to read them. Features are designed to solve this problem, acting as a controller/command action handler: processing input, calling action classes and forming a response. Features should not be responsible for running actual business logic, though. Simply put, all the content of a particular controller or command's method goes inside the Feature. And because it's now there, it can be divided into smaller methods. With that being said, Features must be called from controllers/commands only. Similar to Action, the name of the Feature should answer the question "what should it do?".

A typical feature's tasks include (but not limited to):

  1. Receiving user input and passing it further along the call chain
  2. Calling different Actions
  3. Forming and returning a response

An example of a Feature class and its usage:

With help of the Pixelcone\Fraction\RunsFeatures trait, this class can now be conveniently called within the controller's method:

Contributing to Fraction

To contribute to Fraction, follow these steps:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin pixelcone/fraction
  5. Create the pull request.

Alternatively, see the GitHub documentation on creating a pull request.

Contact

If you want to contact me you can reach me at [email protected].

License

This project uses the following license: MIT.


All versions of fraction with dependencies

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

Loading the files please wait ....