How to use composer in a localwp project? - php

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

Related

How to update a legacy concrete5 package

A long long time ago, I've developed a concrete5 package for concrete5 <= 5.6 for a small non-profit organization. Now, because it has never been upgraded, there are some issues that I can't easily fix, related to the old PHP version. Therefore, I'd like to migrate the web site to a new installation of concrete5 version 8. However, for a fresh install of the latest concrete5, of course my old plugin no longer works. What are the steps to update a legacy concrete5 package to work under the newer concrete5 versions? I couldn't find any info or guides online unfortunately. I have looked at the new documentation on how to develop a package for concrete5 8, but found it very scant. I've changed the namespace of my controller for example, but this is not enough to let the package function. Any insights would be greatly appreciated!
Edit: the code is here
The folder and file structure is mostly the same. YOu have to use namespacing in your classes now. Package controllers have changed a bit in what they extend I think. BLocks are mostly the same. Using JS and CSS assets still works the old way if you prefer but there's a new and better way with asset management.
Feel free to contact me by PM on the concrete5 website my username is mnakalay. There you can tell me more about your package and what it contains (blocks, attributes...) and I can give you a few pointers

How do I use a Laravel package created by me in production?

I'm writing an app using Laravel 4.2. This time, I needed some extra functionality and I decided to create a package. I used the workbench functionality as described in Laravel's docs.
Currently (and locally), the package is very small but it suits my app very well. I don't think this should be published to the community because it is still very green. I'll put a few hours into it when I finish with my app but I can't right now.
Now, I know the workbench/ directory is not to be pushed to production. Then, how do I use my package on production?
So far, I heard I have to push the package to GitHub (which I already did), and then publish it on Packagist. But I feel that publishing the script as is won't be helpful to others and might as well harm those in search of this functionality (like me a few days ago) on this so under developed package.
Is there a way to add my package to my app's composer.json and have it installed without publishing it to the community while it's under development?
What you are looking for is "private repository". Inside your composer.json file you can define an object repositories where you can define other locations to search for this repository
Detailed explanation can be found on Autoload bitbucket repository. The same principal is true for github.

any way to get back PEAR DB functionality from 4 years ago?

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.

PEAR: Using the framework in a distributable application

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.

Managing External and Internal Libraries in Codeigniter with PEAR

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.

Categories