Download the PHP package spatian-dev/ziglite without Composer

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

Ziglite - A Laravel named routes integration for Javascript

GitHub Actions Workflow Status Packagist Version Packagist Downloads NPM Version NPM Downloads

What is Ziglite?

Ziglite provides a way for Laravel developers to use their route names in the front end.\ This package is inspired by, and a lightweight minimalistic alternative to, the excellent and feature-rich Ziggy by Tighten.

Quick Start

Install Ziglite in your Laravel application or package with Composer:

Include the default directive in your Blade @ziglite("*"):

⚠️Warning: This will expose all the named routes and their parameters in your application to the front-end, which may not be desirable.\ See Route filtering to learn about including and excluding routes.

Configure the javascript helpers:

Use the route() helper to transform a named route to a URL:

⚠️Warning: Ziglite does not support Encoded Forward Slashes. See strict mode for more information.

Supported Laravel Versions

Laravel Supported
10.x
11.x

Why Ziglite?

Ziglite is intended to be a simplified alternative to Ziggy. By omitting some of Ziggy's more advanced features, Ziglite offers a focused feature set aimed at ease of use. One notable difference is in filtering: Ziglite opts for a simplified and stricter approach by default.

Additionally, Ziglite boasts seamless integration into Laravel packages, providing developers with the ability to:

We hope Ziglite delivers simplicity and versatility for your Laravel projects and packages.\ If you have ideas or suggestions, please see Contributing.

Usage in a Package

Register Ziglite's service provider inside the register() method of your package's service provider:

You can then use the package the same way you would from a regular Laravel Application.

Route Filtering

Ziglite only includes named routes that match explicitly provided filters. The filtering is based on pattern-matching capabilities provided by Laravel's Str helper.

Exclusion can be defined by starting the pattern with a !

ℹ️ Exclusions patterns are always prioritized over inclusion patterns, regardless of the order in which they are defined.

For example:

You can provide as many inclusion or exclusion patterns as necessary

The Routes Manifest

The core of Ziglite revolves around the \Spatian\Ziglite\Routes\Manifest class. This class collects and caches your application's named routes, and generates a list of named routes that match the provided filters.

Filters

By default, a Manifest instance will only include named routes that match the provided filters. If no filters are provided, then no routes are included.\ Filtering patterns can be provided as the first argument to the constructor.

See Route filtering to learn more about filtering.

Custom Origin

You can specify a custom origin to be included in the manifest.

Caching

The Manifest class caches previously generated manifests for the duration of a request. Subsequent calls with the same filtering patterns simply return the previously calculated result.\ If this is not desirable, you can clear this cache using :

Serializing to JSON

The Manifest class implements JsonSerializable and a toJson() function to simplify serializing to JSON.

The Blade Directive

By default, Ziglite defines a @ziglite blade directive. This directive uses the default JavascriptDataTagGenerator to include a manifest as a JSON object in a blade.\ The JSON object is assigned to a ziglite_data variable on the window global.

Custom Directives and Custom Generators

You can define your custom generators by implementing the OutputGeneratorInterface. This requires implementing a make() function that generates the output as a string.

You can also define a custom blade directive that uses your custom generator. In your AppServiceProvider:

The Front-end Helpers

The javascript library is published to a separate NPM package.

By default, Ziglite does not globally import its javascript helpers. Instead, it defers to the developer to include them and use them as they see fit.\ The library does, however, create an internal default instance of the Router class. You can interact with this instance through the helper functions below.

The configureRouter() helper

Use this function to set the configuration for the default Router instance.

The route() and hasRoute() helpers

The route() function transforms a named route to a URL using the default Router instance. This function works similarly to Laravel's route().

The hasRoute() function checks if the default Router instance has a configured route that matches the given name.

Default Parameters

Ziglite supports Laravel's default parameters.

Generating Absolute URLs

By default, Ziglite will generate relative URLs. To generate absolute URLs instead, set the absolute configuration to true;

Extra Query Parameters

Ziglite will automatically add any unmatched parameters as a query string to the resulting URL:

If you need to add query-string parameters that have the same name as your route's parameter, you can do so under a _query object:

By default, booleans are converted to integers

The Router Class

The Router provides the core of Ziglite's javascript functionality.\ If you would like to use Ziglite's features without modifying the default instance, you might create your own Router instance:

Strict Mode

Ziglite does not support Encoded Forward Slashes. This has historically been buggy, inconsistent and overall not a reliable feature to implement.\ By default, Ziglite will issue a warning in your console if it encounters a forward slash, plain (/) or encoded (%2F), in a parameter value.\ If you enable strict mode, Ziglite will throw an error instead.

Contributing

Please consult the contribution guide.

Credits

License

Ziglite is free and open-source software released under the Apache 2.0 license. See LICENSE for more information.


All versions of ziglite with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.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 spatian-dev/ziglite contains the following files

Loading the files please wait ....