Download the PHP package dovetaily/compio without Composer

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

Compio

Descrption

Compio is an advanced component generator. It works temporarily only on Laravel with Artisan (CLI) by generating Blade components, but you can customize it to generate components from other template engines like Twig or VueJs or others.

How to install

After creating your laravel project you have "Two methods" to install Compio The two methods are:

First method

In your file ./composer.jsonyou need to paste this :

Copy it and paste it into your file ./composer.json in the key(or property) scripts.post-autoload-dump. You need to paste it like this:

Finally, run the following command in your project :

If the script Compio\\ComposerScripts::postAutoloadDump was successful, you will see in your file ./app/Console/Kernel.php a line of code that looks like this :

If you don't have this line of code in your file ./app/Console/Kernel.php, make sure the method commands exists and there is this line of code require base_path('routes/console.php'); and then re-run the command composer dump-autoload in the console.

If all in all your file still hasn't added this require_once getcwd() . '\vendor\dovetaily\compio\src\Environments\Laravel\...';, then try the second method.

If all goes well, a configuration file Compio with the minimum possible configuration will be created. Here is the content of this configuration file :

Everything concerning the customization of component generations will be done in this configuration file and will be explained later. Finish for the First method !

Second method

In this second method, you will paste the code corresponding to your Laravel version into your file ./app/Console/Kernel.php in the commands.

Your ./app/Console/Kernel.php file will look like this :

Finish for the Second Method !

Finishing the installation

If you are trying one or both methods, run the command php artisan list as follows to confirm that Compio is working:

If you have tried both methods and you do not have this result, then please check your version Laravel if it conforms to the versions supported by Compio.

How to use

Compio is very easy to use. When Compio generates a component it creates by default 4 file templates including :

However, you can customize the folder paths or select the generated template or more, create your own generated templates.

There are two ways to use Compio.

1 - Direct use with the console

Let's see the Compio command in depth.

The command usage looks like this :

Let's illustrate this with the example above :

The command php artisan compio:component Path/MyComponent string:my_string_type_argument="Default value" array:null:my_array_or_null_type_argument_2= my_argument_require_3 receives all component information on a single line, but you can also run it as follows :

Let's see the generated files

File my_project\app\View\Components\Path\MyComponent.php

On the following line :

Let's analyze the generated arguments :

File my_project\resources\views\components\Path\MyComponent.blade.php

File my_project\public\css\components\Path\MyComponent.css

File my_project\public\js\components\Path\MyComponent.js

2 - Use with a configuration file

In this section, we will use data from a configuration file. During the installation of Compio when all goes well, it generates a configuration file ./my_project/config/compio.php if it is not created please create it, and to configure what affects the generations of the components, add the key component and inside you add the key there config and for a minimum rendering of the configuration, it will give this :

A. Utiliser simplement le fichier de configuration pour générer plusieurs composants

So we have component.config, and before seeing the possible compio configurations in point 'B' , we will first see how to generate several components at the same time. Please add the key where the list of your generated components will be stored, it can be named as you wish but cannot contain the symbol |. So for an example we will add the key datas and the structure will become component.datas. And we're going to put our components there.

Now that the configuration file has components to generate, we'll run the following command php artisan compio:component "#config|[config_keys]". The entry [config_keys] will be the configuration path to the components key like when we use config([config_keys]) Laravel's helper function :

Namely, we will see the parameters (arguments) of the __construct component method Cards/Post/User to understand the default values of the arguments : File C:\Path\...\my_project\app\View\Components\Cards\Post\User.php

B. Possible compio configurations

Here are the main keys of compio for a good personal management of the library :

As you may have noticed, when you generate a component, there are four files that are created and these files correspond to the number of templates that there are in component.config.template(class, render, css and js). Before seeing how to Add, Stop or Modify Templates , we will first see the keys component.config.require_template and component.config.replace_component_exist

The key component.config.require_template

When you run a command to generate a component, it does not ask you which generated template, it automatically generates 4 template files predefined by Compio.

The key component.config.require_template only accepts values of type : bool

We will see an example when the key component.config.require_template is true.

And in the console :

And that's when for the key 'require_template' => true. When it is false, the generation process will be done as in the examples above.

The key component.config.replace_component_exist

This key gives us a way to Replace, Ignore or Choose, a component that already exists.

The key component.config.replace_component_exist only accepts values of type : bool|null

Example if component.config.replace_component_exist is null

Example if component.config.replace_component_exist is true

Example if component.config.replace_component_exist is false

You can also configure it directly on the command line with the option --replace.

The key to templates (component.config.template)

This key has default templates including :

The template class

The Compio configuration values for this template are :

Here's how the default template file(template_file) looks like :

We now clearly observe the keywords @command, @namespace, @class_name, @locate_css, @locate_js, @locate_render, @args_init, @args_params, @args_construct and @args_render

You can customize the keywords to return what you need. Example :

Anything you put as text in a keyword will be replaced in the same keyword in the template file, but the keyword can contain a callback function, like this :

Namely, here is the argument structure of the callback function :

Le modèle render

The Compio configuration values for this template are :

Here's how the default template file(template_file) looks like:

In this template file, there are two new keywords including @component_name and @class_html.

Let's see what these keywords contain :

Le modèle css

The Compio configuration values for this template are :

Here's how the default template file(template_file) looks like :

Le modèle js

The Compio configuration values for this template are:

Here's how the default template file(template_file) looks like :

Create your own templates

The creation of the templates is very simple, let's start by making a new configuration. To add your own template, you must place it in the key component.config.template.my_template

By following this structure you have the possibility to create your own templates. If you create a template from the name of the templates that already exist (eg class, render, css and js), you will have the default values for this template. The templates class, render, css and js are automatically generated by Compio, to prevent this you will need to set their key generate to the value false, like this:

The keywords in depth

You should know that you can also create your own keywords component.config.template.my_template.keywords.my_own_keyword Default keywords already has values including :

And when you create your keyword, it will be merged with the default value of keywords.

You can also get your arguments as a keyword, as follows @args[argument key][string template] In the template text you can write whatever you want and combine it with the argument information :

Now let's see how to create a keyword. The instructions are simple to have a keyword you must respect : 1 - The regular expression /^@([a-z_]+.*|[a-z_]+|[a-z_])$/i 2 - The value of your default value must be of type string|closure. The closure must return a value of type string|null. Example :

Apply different configurations in multiple components

By using the configuration file to generate several components, you will be able to apply different configurations for each of them.


All versions of compio with dependencies

PHP Build Version
Package Version
No informations.
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 dovetaily/compio contains the following files

Loading the files please wait ...