Do I need Bower for front end dependencies when I am already using composer?

I use composer for PHP dependencies. I was under the impression that for front end dependencies I should use Bower. So, I installed Bower and loaded my FE dependencies (Bootstrap, jQuery) using that. I then manually symlink to the libraries as follows:

mypc:/var/www/myproject/public/js$ ls -l
total 8
lrwxrwxrwx 1 tom tom   67 Dec 23 07:29 bootstrap.min.js -> /var/www/myproject/bower_components/bootstrap/dist/js/bootstrap.min.js
lrwxrwxrwx 1 tom tom   58 Dec 23 07:29 jquery.min.js -> /var/www/myproject/bower_components/jquery/dist/jquery.min.js

However, I notice that these are stored within a directory /bower_components just as composer dependencies are stored in /vendor. So now I have /bower_components and /vendor as well as /node_modules (for grunt and grunt plugins). So as all Bower does it bring down the repositories, upon which I need to link to them – can I not just use composer for front end libraries too?

"components/jquery": "dev-master"
"components/bootstrap": "dev-master"

.. then create symlinks to the files (e.g. .js .css) in my public/* directories? Is there any reason whhy Bower is still better for managing FE dependencies? Thanks

2

No Composer is a dependency manager for PHP only while Bower is optimized for front end dependencies that can be used with not only sites built with PHP but built with other programming languages and frameworks. I would stick with Bower for front end dependency management as that’s what its designed for. 🙂

1

I just stumbled across this gem that will allow you to use Composer with Bower packages:

https://github.com/francoispluchino/composer-asset-plugin

From their Readme:

The Composer Asset Plugin allows you to manage project assets (css,
js, etc.) in your composer.json without installing NPM or Bower.

This plugin works by transposing package information from NPM or Bower
to a compatible version for Composer. This allows you to manage asset
dependencies in a PHP based project very easily.

Features include:

  • Works with native management system versions of VCS repository of composer
  • Works with public and private VCS repositories
  • Lazy loader of asset package definitions to improve performance
  • Import filter with the dependencies of the root package and the installed packages, for increased dramatically the performance for the
    update
  • Automatically get and create an Asset VCS repository defined in:
    • NPM Registry
    • Bower Registry
  • Automatically get and create the Asset VCS repositories of dependencies defined in each asset package (dev dependencies
    included)
  • Mapping conversion of asset package to composer package for:
    • NPM Package – package.json
    • Bower Package – bower.json
  • Conversion of Semver version to the composer
    version
  • Conversion of Semver range version to the
    composer range version
  • Conversion of dependencies with URL to the
    composer dependencies with the creation of VCS repositories
  • Conversion of multiple versions of the same dependency
    to different dependencies of composer
  • Add manually the multiple versions of a same dependency in the project
  • Add a custom config of VCS Repository
  • Override the config of VCS Repository
    defined by the asset registry directly in extra section of root
    composer
  • VCS drivers for:
    • Git
    • GitHub (compatible with repository redirects)
    • Git Bitbucket
    • Mercurial
    • Mercurial Bitbucket
    • SVN
    • Perforce
  • Local cache system for:
    • package versions
    • package contents
    • repository redirects
  • Custom asset installers configurable in the root file composer.json
  • For Bower, all files defined in the section ignore will not be installed
  • Disable or replace the deleting of the ignore files for Bower
  • Enable manually the deleting of the ignore files for NPM
  • Use the Ignore Files Manager in the Composer scripts
  • Compatible with all commands, including:
    • depends
    • diagnose
    • licenses
    • remove
    • require
    • search (bower only)
    • show
    • status

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Do I need Bower for front end dependencies when I am already using composer?

I use composer for PHP dependencies. I was under the impression that for front end dependencies I should use Bower. So, I installed Bower and loaded my FE dependencies (Bootstrap, jQuery) using that. I then manually symlink to the libraries as follows:

mypc:/var/www/myproject/public/js$ ls -l
total 8
lrwxrwxrwx 1 tom tom   67 Dec 23 07:29 bootstrap.min.js -> /var/www/myproject/bower_components/bootstrap/dist/js/bootstrap.min.js
lrwxrwxrwx 1 tom tom   58 Dec 23 07:29 jquery.min.js -> /var/www/myproject/bower_components/jquery/dist/jquery.min.js

However, I notice that these are stored within a directory /bower_components just as composer dependencies are stored in /vendor. So now I have /bower_components and /vendor as well as /node_modules (for grunt and grunt plugins). So as all Bower does it bring down the repositories, upon which I need to link to them – can I not just use composer for front end libraries too?

"components/jquery": "dev-master"
"components/bootstrap": "dev-master"

.. then create symlinks to the files (e.g. .js .css) in my public/* directories? Is there any reason whhy Bower is still better for managing FE dependencies? Thanks

2

No Composer is a dependency manager for PHP only while Bower is optimized for front end dependencies that can be used with not only sites built with PHP but built with other programming languages and frameworks. I would stick with Bower for front end dependency management as that’s what its designed for. 🙂

1

I just stumbled across this gem that will allow you to use Composer with Bower packages:

https://github.com/francoispluchino/composer-asset-plugin

From their Readme:

The Composer Asset Plugin allows you to manage project assets (css,
js, etc.) in your composer.json without installing NPM or Bower.

This plugin works by transposing package information from NPM or Bower
to a compatible version for Composer. This allows you to manage asset
dependencies in a PHP based project very easily.

Features include:

  • Works with native management system versions of VCS repository of composer
  • Works with public and private VCS repositories
  • Lazy loader of asset package definitions to improve performance
  • Import filter with the dependencies of the root package and the installed packages, for increased dramatically the performance for the
    update
  • Automatically get and create an Asset VCS repository defined in:
    • NPM Registry
    • Bower Registry
  • Automatically get and create the Asset VCS repositories of dependencies defined in each asset package (dev dependencies
    included)
  • Mapping conversion of asset package to composer package for:
    • NPM Package – package.json
    • Bower Package – bower.json
  • Conversion of Semver version to the composer
    version
  • Conversion of Semver range version to the
    composer range version
  • Conversion of dependencies with URL to the
    composer dependencies with the creation of VCS repositories
  • Conversion of multiple versions of the same dependency
    to different dependencies of composer
  • Add manually the multiple versions of a same dependency in the project
  • Add a custom config of VCS Repository
  • Override the config of VCS Repository
    defined by the asset registry directly in extra section of root
    composer
  • VCS drivers for:
    • Git
    • GitHub (compatible with repository redirects)
    • Git Bitbucket
    • Mercurial
    • Mercurial Bitbucket
    • SVN
    • Perforce
  • Local cache system for:
    • package versions
    • package contents
    • repository redirects
  • Custom asset installers configurable in the root file composer.json
  • For Bower, all files defined in the section ignore will not be installed
  • Disable or replace the deleting of the ignore files for Bower
  • Enable manually the deleting of the ignore files for NPM
  • Use the Ignore Files Manager in the Composer scripts
  • Compatible with all commands, including:
    • depends
    • diagnose
    • licenses
    • remove
    • require
    • search (bower only)
    • show
    • status

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật