I want to start using more libraries for my codeigniter project, but I am weary of having them all in my vcs or having to manually manage versions of the libraries. I've recently found this PEAR Guide but I don't see anything about existing codeigniter libraries being available through this system. Does a CI specific PEAR repo exist and if not, how difficult is it to get packages into PEAR?
You can setup your own pear channel server (i.e. via pirum, pearhub or pearfarm) and put your own package in there. it's not that hard to build your own packages - you can even automate it with a phing script.
See also a similar question here on Stackoverflow with a more complete list of channel servers.
Related
I’m a newby on using composer, git, etc, in fact I’ve never used them, but I need the Spaces API PHP library (which requires composer) for my project.
Since LocalWP includes composer, could anyone tell me in detail how to integrate it into my project?
The tutorials I've found are not ment for LocalWP specific case. All of them teach u how to install composer, but since LocalWP has it already, I don't know how to apply it to my project.
My System Details:
LocalWP latest version
Windows 10 Pro
Chrome
VS Code
(As first, this question is not "which is better" question. I just want to know how they are similar and differ in functionality perspective.)
I'm php developer and currently learning ruby.
In these days, many php developers are encouraged to use Composer for dependency management. Before asking questions, I would like to validate my knowledge first.
According to my understanding,
Composer is a dependency management tool for php libraries (or packages).
Composer installed php library per project basis (so-called locally). I mean php library installed for project1 cannot be reused for project2 without install again for project2.
I've noticed that Ruby also has very good dependency management tool "RubyGems".
According to my knowledge,
"RubyGems" is a package manager for "Gems".
"Gem" is a Ruby program or library packaged in a standard format for sharing. (Rails is also a gem.)
Gem can be installed by command like that gem install sinatra.
But, there is also so-called "Bundler" which is also a gem for bundling gems for an application.
When command bundle install runs (under specific ruby project directory), all the gems listed in the Gemfile are installed for this ruby project.
So, my questions are here.
Composer is similar to whether RubyGems or Bundler ?
When run gem install sinatra, is it installed on system-wide level ?
When run bundle install, the Gems are installed whether locally (on this project only) or system-wide level ?
If I need two versions of one gem (for e.g. sinatra) for different projects, how should I handle ?
(Sorry for my long question. If my understandings are something wrong, sorry again and please point out the right one.)
1) Composer is more similar to bundler.
Composer brings everything in your project, bundler brings everything to your system and "links" them in the context of your project. Bundler is working with gems in the back.
2) yes. gem install does things system-wide (or per user if you use something like rbenv or rvm)
3) see 1. system wide and are correctly picked according to the Gemfile when you run things through bundle exec
4) I recommend using a Gemfile, putting the version you're interested in there and letting bundler do the rest (it will in the back install multiple versions and pick the right one). Be sure to run "bundle exec" though.
You also have the option of using an rvm gemset if you're into rvm but that's harder to handle and you will have a really bad time when attempting to deploy.
I have an application built in 2007 that makes extensive use of PEAR's AUTH and DB packages. It had been mothballed but out again now. Since those packages are not available and pear has completely changed, it no longer works in my system.
Outside of rewriting the entire software, is there anyway to get the previous functionality of DB & AUTH packages?
Thanks.
If you don't mind doing some investigative work yourself, you could look at the changelog pages for both of those packages - at http://pear.php.net/package/Auth/download/All and http://pear.php.net/package/DB/download/All to determine which version of these packages you had installed and used when you developed your application.
Once you've confirmed and installed the specific versions of these packages that you need, you might want to consider writing what's called a "PEAR Meta Package" and committing it to your version control system so that you can ensure these specific packages can be easily installed again (on other servers, whichever) with minimum hassle.
I am working on a PHP application that uses many features from PEAR. The app is meant to be distributable kind of like Wordpress but really scaled down.
Now the problem I've run into is that PEAR needs to be installed and configured alongside the PHP server without which my app simply will not function unless the users go through all the painful steps of installing PEAR on their server. Users can very well be newbies or non-technical so it's not an option for them.
Therefore there is a need to somehow package everything PEAR into the application itself. As far as I know it may not be possible.
Are there any alternate solution to this? Any solution at all will help. Thanks..
PEAR installs system wide dependencies which makes things like what you describe hard. Composer on the other hand is exactly what you'd need, because it's a per-project dependency manager with much better support for resolving and installing of dependencies. Basically, compared to Composer, PEAR sucks... it always did, Composer on the other hand rocks!
The first thing I would do for each package you need is to see if it is also provided on https://packagist.org/. If it is, problem solved, include the installation into your build process with composer. If you end up with only a few packages from PEAR, you have several options:
inspire the author to provide it on packagist
make your own mirror on packagist (not recommended but sometimes necessary)
see if the project is on github and install directly from git with composer
install the PEAR package via composer anyways, it's possible.
Short answer: switch to composer!
If you are talking about the PEAR packages or class files, you can put the PEAR packages anywhere you want. Just put the ones you use into a dir within your app dir structure and add that to the include path.
How should PEAR libraries be incorporated as packages / libraries within PHP frameworks?
Namely, I'm using a package system within a PHP framework - and need those PEAR libraries to be easily redistributable (I'm referring specifically to CodeIgniter's package manager, Sparks) to other users. Would it be better to couple the needed PEAR libraries and their dependencies within the package itself, or to instead do a check when the package is initialized (ie constructor, init, factory, whatever called) and prompt (along with download instructions) that that user install the necessary dependencies?
The latter option may not work for some users who lack either the necessary permissions (ie shared hosting?) or the necessary technical knowledge (don't laugh, I'm serious) to install PEAR libraries, ie framework users, not programmers / system admins.
Coupling opens the risk of code duplication within a project, even if it greatly simplifies making the package "just work". What route would YOU take?
Use Pyrus, the next-gen pear installer and follow the instructions in Using Pyrus To Manage PEAR Installable Vendor Libs.