Download the PHP package kirschbaum-development/paragon without Composer

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

Paragon

A tool for automatically generating typescript/javascript objects and utilities based on their PHP counterparts.

Latest Version on Packagist Total Downloads Actions Status

Requirements

Laravel Version Paragon Version
11.0 1.0.x
10.0 1.0.x

Installation

TypeScript Enums

Enums are a fantastic addition to the PHP-verse but are really lame in the TypeScript-verse. However, it can be annoying trying to get those enum values on the front-end of your project. Are you supposed to pass them as a method when returning a view or perhaps via an API? This generator solves that problem by scraping your app directory for any and all enums and recreates them as TypeScript classes so you can import them directly into your Vue, React, or Svelte front-end!

The simplest way to get started is to run the following command:

That's it. Now, wherever you may have had enums in your project, "paragons" or near perfect duplicates of those have been recreated inside of resources/js/enums. Here are some examples of the API:

As you can see the API is nearly the same, the only difference being how the two languages expect you to access objects!

Let's take a closer look at a simple PHP enum and its generated Typescript code.

At first glance it appears as though a lot more stuff is happening, but the above generated code allows us to interact with the enum in a nearly identical way as in PHP. And you may notice the generated TypeScript class extends the Enum class. This gives us some underlying functionality that is available to every enum.

Public Methods

A good majority of the time it is useful to use public methods to return a proper human-readable label or some other functionality on an enum. We've got this covered too. Assuming the following method exists on the above Status enum:

The following method would become accessible using TypeScript:

Custom Static Methods

Traits can also be applied to enums that give the extra functionality via static methods. While this package ignores static methods as it would be pretty difficult to convert PHP code into TypeScript automatically, we allow you to create files that Paragon will auto-import for you so you can add the same type of functionality on the front-end! Simply run

You can either let it prompt you for a name or pass it in via the CLI name argument. This will create a new file at resources/js/vendors/paragon/enums. You are free to do whatever you need inside this file. You have direct access to this.items which allows you to interact with the enum cases in whatever way you need. Just keep in mind that because the items are "frozen", you can't mutate them directly.

Ignoring Enums Or Public Methods

There may be enums or enum methods that you don't want inside your automatically generated code. If this is the case simply use the IgnoreParagon attribute.

Configuration

You can publish the configuration file by running php artisan vendor:publish and locating the Paragon config which will be published at config/paragon.php.

Recommendations

It is recommended that the generated path for the enums is added to the .gitignore file. Make sure to run this command during deployment if you do this.

Automatically Re-generating When Modifying PHP Enums

Install the vite-plugin-watch plugin in your project via npm:

In your vite.config.js file, import the plugin, and add the plugin paramaters to your plugins array:


All versions of paragon with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/filesystem Version >=10.0
illuminate/support Version >=10.0
symfony/filesystem Version >=6.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 kirschbaum-development/paragon contains the following files

Loading the files please wait ....