Download the PHP package 68publishers/smart-nette-component without Composer

On this page you can find all versions of the php package 68publishers/smart-nette-component. 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 smart-nette-component

Smart Nette Component

This package adds some useful features for Nette Presenters and Components, such as authorization for Presenters, their actions and signals using PHP8 attributes, authorization for component signals using attributes, and resolving of component template files.

Checks Coverage Status Total Downloads Latest Version PHP Version

Installation

The best way to install 68publishers/smart-nette-component is using Composer:

Authorization attributes

To use the authorization attributes, you need to register a compiler extension.

Attributes can be cached when folding the DI container to avoid using reflection at runtime. The extension will create a classmap and a map of all attributes automatically, it just needs to know where to look for Presenters and Components. This is done with the scanDirs, scanComposer and scanFilters options, which behave similarly to nette/application.

Now add the following trait to your BasePresenter and BaseControl:

From now, you can use authorization attributes in your Presenters and Components:

The Presenter/Component throws the exception SixtyEightPublishers\SmartNetteComponent\Exception\ForbiddenRequestException if any of the conditions in the attributes are not met.

The package includes the following attributes:

If you would like to react somehow to the thrown exception, you can overwrite the onForbiddenRequest() method in a Presenter/Component.

Custom authorization attributes

You can register your own attributes in the following way:

Template resolving

You don't need to register any compiler extension to use this feature, just use the TemplateResolverTrait trait in your BaseControl.

The base render() method is already declared in the trait. To assign variables to the template, we can use the beforeRender() method. You can also define custom render*() methods that are called for rendering using {control myControl:foo}.

The template for the base render method will be resolved as COMPONENT_DIRECTORY/templates/myControl.latte or COMPONENT_DIRECTORY/templates/MyControl.latte.

The template for the foo render method will be resolved as COMPONENT_DIRECTORY/templates/foo.myControl.latte or COMPONENT_DIRECTORY/templates/foo.MyControl.latte.

Of course, you can set a template file manually:

Contributing

Before opening a pull request, please check your changes using the following commands


All versions of smart-nette-component with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
nette/application Version ^3.1.0
nette/di Version ^3.0.10
nette/security Version ^3.1.4
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 68publishers/smart-nette-component contains the following files

Loading the files please wait ....