Download the PHP package structuraphp/structura without Composer

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

Structura

License

About

Structura is an architectural testing tool for PHP, designed to help developers maintain a clean and consistent code structure.

Requirements

PHP version

Version PHP Structura 0.x
<= 8.1 ✗ Unsupported
8.2 / 8.3 / 8.4 ✓ Supported

Installation

Using Composer

Usage

Configuration

Create the configuration file required for running the tests:

At the root of your project, add the namespace and directory for your architecture tests:

Make test

After creating and completing your configuration file, you can use the command to create architecture tests:

Here's a simple example of architecture testing for your DTOs:

fromDir() and fromRaw()

Start with the fromDir() method, which takes the path of the files to be analysed. It can take a second closure parameter to customise the finder:

fromRaw() method can be used to test PHP code in the form of a string:

that()

Specifies rules for targeting class analysis, optional functionality:

except()

Ignores class rules, can be used as a baseline, optional functionality:

should()

List of architecture rules, required functionality:

First run

To run the architecture tests, execute the following command:

Assertions

toBeAbstract()

toBeAnonymousClasses()

toBeClasses()

toBeEnums()

Must be a valid Unit Enum or Backed Enum.

toBeBackedEnums()

Must be a backed enumeration, if ScalarType is not specified, int and string are accepted.

https://www.php.net/manual/en/language.enumerations.backed.php

toBeFinal()

toBeInterfaces()

toBeInvokable()

toBeReadonly()

toBeTraits()

toBeAttribute()

dependsOnlyOn()

You can use regexes to select dependencies.

dependsOnlyOnAttribut()

If you use the rule classes toHaveAttribute(), they are included by default in the permitted dependencies.

dependsOnlyOnImplementation()

If you use the rule classes toOnlyImplement() they are included by default in the permitted dependencies.

dependsOnlyOnInheritance()

If you use the rule classes toExtend() they are included by default in the permitted dependencies.

dependsOnlyOnUseTrait()

If you use the rule classes toOnlyUseTrait() they are included by default in the permitted dependencies.

toNotDependsOn()

You can use regexes to select dependencies

dependsOnFunction()

You can use regexes to select dependencies

toNotDependsOnFunction()

Prohibit the use of function.

You can use regexes to select dependencies

toExtend()

toExtendsNothing()

toImplement()

toImplementNothing()

toOnlyImplement()

toUseTrait()

toNotUseTrait()

toOnlyUseTrait()

toHaveAttribute()

toHaveNoAttribute()

toHaveOnlyAttribute()

toHaveMethod()

toHaveConstructor()

toHaveDestructor()

toHavePrefix()

toHaveSuffix()

toUseStrictTypes()

toUseDeclare()

toBeInOneOfTheNamespaces()

Allows you to specifically target classes contained in a namespace.

Information !

Anonymous classes cannot have namespaces

You can use regexes to select namespaces.

notToBeInOneOfTheNamespaces()

Allows you to specifically target classes not contained in a namespace.

Information !

Anonymous classes cannot have namespaces

You can use regexes to select namespaces.

and()

To be valid, all the rules contained in the and() method must meet the requirements.

or()

To be valid at least one of the rules contained in the or() method must meet the requirements.

Custom assert

To create a custom rule, implement the StructuraPhp\StructuraContracts\ExprInterface interface:

To use a custom rule, add it using the addExpr() method.

Use existing rules as an example.

With PHPUnit

Structura can integrate architecture testing with PHPUnit with this project:

https://github.com/structuraphp/structura-phpunit


All versions of structura with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3|^8.4
nikic/php-parser Version ^5.4
symfony/console Version ^7.2
symfony/filesystem Version ^7.2
symfony/finder Version ^7.2
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 structuraphp/structura contains the following files

Loading the files please wait ....