Download the PHP package zareismail/flexi without Composer

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

Introduction

Requirements

Installation

Resources

Introduction

Flexi is a powerful package designed to seamlessly integrate widgets into Laravel applications. It consists of two main components: Widgets and Resources. Widgets enable dynamic content display, while Resources provide a structured way to navigate through the application.

Requirements

Before installing Flexi, please ensure that you have the following requirements:

Installation

To install Flexi, use the following command:

Defining Resources

By default, Flexi resources are stored in the app/Flexi directory of your application. You can generate a new resource using the flexi:resource Artisan command:

Registering Resources

By default, all resources within the app/Flexi directory are automatically registered with Flexi. You can manually register resources using the resourcesIn or resources methods:

Make sure to include these code snippets in the boot method of your service provider.

Navigating

Once you have registered your resources with Flexi, you can navigate through the application using their respective URLs. By default, the URL for accessing a generated resource combines the resources prefix (the default group name) with the resource's uriKey. For example, a Post resource would be available at http://localhost/resources/posts. However, you can further customize this URL.

Grouping Resources

Each registered resource's URI path is prefixed by the resources key. To remove this prefix, you can edit the group property of the resource:

After this change, you can navigate to http://localhost/posts to access the resource.

Bounded Resources

By default, Flexi prefixes the URL path of each registered resource with its uriKey (which is the pluralized slug of the class name). To remove this prefix, modify the bounded method of the resource:

When bounded method returns false, Flexi removes the resource's uriKey from its URI. As a result, you can access the ungrouped unbounded Post resource using the http://localhost/ URL.

Wildcard Resources

By default, Flexi restricts the resource to a specific URL. However, if you want to catch any wildcard URLs for the resource, override the wildcard method of the resource:

When wildcard returns true, Flexi dispatches all paths prefixed by the resource's uriKey. As a result, you can access the ungrouped wildcard Post resource using the http://localhost/posts/ANYTHING URL, where ANYTHING can be any string combined with the URL path separator.

Wildcard Resources

Laravel's fallback routes allow you to handle undefined routes or 404 errors gracefully by redirecting them to a specific route or controller action. With the new feature added to the "Flexi" package, you can now specify a fallback resource, which is a Flexi resource, to handle these fallback routes within your Laravel application. If you want to determine a resource as fallback, override the fallback method of the resource:

This feature is handy when you want to customize the behavior of the fallback routes and provide a user-friendly experience when users encounter undefined routes or pages. pay attention that a wildcard ungrouped unbounded resource, also can work like a fallback resource.

Resolving Resources

Each resource generated by the Flexi command contains a resolve method that allows you to customize data retrieval and attach it to the resource after it is resolved by the request. For example, if you need to retrieve a model from the database for the requested resource, you can do so using the following approach:

In this example, the resolve method retrieves a Post model from the database based on the URI segment of the request. It then assigns the retrieved model to the $post property of the resource. If the model is not found, it aborts the request with a 404 response.

You can customize the resolve method to suit your specific requirements, allowing you to fetch and attach relevant data to the resource based on the incoming request.

Widgets

While the Flexi resource allows you to navigate through the application, Flexi's "Widgets" feature enables you to display data based on the navigated resources for incoming requests.

Defining Widgets

You can generate a widget using the flexi:widget Artisan command, which by default places newly generated widgets in the app/Flexi/Widgets directory:

Each widget generated by Flexi contains two methods: resolve and render. The resolve method prepares the relevant data for the widget before calling the render method, which returns the final generated content to be displayed.

Registering Widgets

Once you have defined a widget, you can attach it to a resource. Each resource generated by Flexi contains a widgets method. To attach a widget, simply add it to the array of widgets returned by this method. Widgets can be created using their static make method, typically passing the "human readable" name for the widget as an argument:

Authorization

Sometimes, you may want to hide certain widgets from a group of users. You can accomplish this by using the canSee method chained onto your widget definition. The canSee method accepts a closure that should return true or false. The closure receives the incoming HTTP request, allowing you to perform authorization checks:

These additional authorization checks ensure that the widget is only visible to users who meet the specified criteria.


All versions of flexi with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.13
spatie/once Version ^3.1
symfony/finder Version ^6.3
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 zareismail/flexi contains the following files

Loading the files please wait ....