S
S
Sergey Beresnev2013-02-06 04:36:20
PHP
Sergey Beresnev, 2013-02-06 04:36:20

I can’t figure out how to properly organize the package structure and file connection

There is a self-written library. I began to bring it to the form of the Composer package. I put a dependency on the templating engine (Smarty).

This library has a console tool (script) for generating templates of a certain type. And this script uses a template engine.

How can I arrange this script so that I can get my package and run the script to generate the template without unnecessary gestures in the application?

ps And how can I use this script in the library itself? Okay, the template engine will be placed in the vendor folder, but it turns out that I will have to write my own autoloader for my library.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
avorobiev, 2013-02-06
@sectus

Based on the questions, you should read the getcomposer.org/doc/ documentation . Yes, it is unclear, especially in terms of the composer.json structure, but there is still a lot of information “to start”:
1. The package structure is defined by PSR-0 (https://github.com/php-fig/fig-standards/ blob/master/accepted/PSR-0.md). This is required for autoload to work. I am not aware of other restrictions on the structure. If autoloading from composer is not needed, but only package deployment is needed, then there is no restriction on PSR-0, although, in my opinion, this standard should be followed in any case.
2. Composer has its own autoloading, you just need to include it in your getcomposer.org/doc/01-basic-usage.md#autoloading scripts . This autoload can replace yours (if you have one).
3. I understand that there is a question about how to write composer.json for your own package. Apparently you need to read the documentation about this getcomposer.org/doc/04-schema.md , and see how it is done in existing packages.
4. You probably still need to figure out where you plan to host your package, it depends on how it will need to be included in the project. This is also in the documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question