symfony / apache-pack

A Symfony Pack for Symfony Apache
https://symfony.com/
MIT License
948 stars 7 forks source link

Purpose of this package #5

Open mauricios opened 4 years ago

mauricios commented 4 years ago

I'm upgrading a Symfony 2.6 installation and found this package as a dependency. This package seems to be empty and it doesn't add any functionality. Is this package/project deprecated?. Can I safely remove it from the composer dependencies?

florianrusch commented 4 years ago

@mauricios if I'm correct, it should bring you the .htaccess file into your public folder. (https://symfony.com/doc/current/setup/web_server_configuration.html#adding-rewrite-rules)

It seems for me, that the .htaccess files comes from this repo: https://github.com/symfony/recipes-contrib/blob/master/symfony/apache-pack/1.0/public/.htaccess

But I have no clue how 🙈 maybe this issue could give you more informations: https://github.com/symfony/apache-pack/issues/1

I've added this package a view minutes ago into my symfony 4.4 project:

$ composer require symfony/apache-pack
Using version ^1.0 for symfony/apache-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Package operations: 1 install, 0 updates, 0 removals
  - Installing symfony/apache-pack (v1.0.1): Downloading (100%)         
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (f9810c626acc52037e6c45db73be494f)
  -  WARNING  symfony/apache-pack (>=1.0): From github.com/symfony/recipes-contrib:master
    The recipe for this package comes from the "contrib" repository, which is open to community contributions.
    Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/symfony/apache-pack/1.0

    Do you want to execute this recipe?
    [y] Yes
    [n] No
    [a] Yes for all packages, only for the current installation session
    [p] Yes permanently, never ask again for this project
    (defaults to n): y
  - Configuring symfony/apache-pack (>=1.0): From github.com/symfony/recipes-contrib:master
Executing script cache:clear [OK]
Executing script assets:install public [OK]

Some files may have been created or updated to configure your new packages.
Please review, edit and commit them: these files are yours.

$ ll public 
-rw-r--r--   1 florianrusch  staff   3.2K Jan  9 21:43 .htaccess
-rw-r--r--   1 florianrusch  staff   6.6K Nov  9 12:03 apple-touch-icon.png
drwxr-xr-x   6 florianrusch  staff   192B Jan  6 19:11 css
-rw-r--r--   1 florianrusch  staff   6.4K Nov  9 12:03 favicon.ico
drwxr-xr-x   7 florianrusch  staff   224B Nov 24 13:03 images
-rw-r--r--   1 florianrusch  staff   805B Jan  7 17:26 index.php
drwxr-xr-x   5 florianrusch  staff   160B Jan  6 19:11 js
drwxr-xr-x   3 florianrusch  staff    96B Nov 16 10:41 uploads
ixalsera commented 4 years ago

Was wondering the same as @mauricios as the Composer file lists no requirements and the repo itself contains no code. Thanks to the above from @florianrusch and the Symfony docs though, it looks like this is a Symfony Flex package.

@mauricios , to answer your question then, if you are using Symfony Flex in your application, then leave it in as it may be adding in the .htaccess rules (for things like CORS). If you aren't, then it's safe to remove.

However, I will go on to say that even if you are, if the .htaccess file is the only file it adds through the Flex recipe, I would only add it as a dev requirement and rather add the rules from it in to your main production Apache config for faster resolution (if you have access to the httpd.conf file), as suggested here.

Tobion commented 3 years ago

This repo is only there so symfony flex can execute the recipe when installing, adding the .htaccess file automatically. I think we should add a note in the readme of this repo to make this clear.