I'm trying to use the PHP-SDK and I just can't get it to work. I'm not familiar with the use and namespace statements in PHP and I'm trying to understand it.
{
"repositories": [
{
"type": "package",
"package": {
"name": "payone/php-sdk",
"version": "1.0.0",
"dist": {
"url": "http://github.com/PAYONE/PHP-SDK/archive/master.zip",
"type": "zip"
},
"autoload": {
"psr-0": { "Payone_": "php/" }
}
}
}
],
"require": {
"payone/php-sdk": "1.0.*"
}
}
As far as I understand this tries to load the Autoload.php in my payone/php-sdk/php folder with the class prefix Payone_. This seems fine to me but I can't use $builder = new Payone_Builder(); in my controller now. What am I doing wrong?
You need to add the use statement to your controller.
use Payone_Builder;
as per 2015/03 new zip url
{
"repositories": [
{
"type": "package",
"package": {
"name": "payone/php-sdk",
"version": "1.0.0",
"dist": {
"url": "http://www.payone.de/uploads/media/php-sdk.zip",
"type": "zip"
},
"autoload": {
"psr-0": {"Payone_": "php/"}
}
}
}
]
}
Related
I got this error as i validate my composer.json file:
[Composer\Json\JsonValidationException]
"./composer.json" does not match the expected JSON schema:
- name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$
The name Property looks like this:
"name":"lukas735/united-in-faith",
I also tried out the following alternations:
"lukas735/united-in-faith",
"lukas/united-in-faith",
"lukas735/united.in.faith",
"lukas/united.in.faith",
"lukas735/united_in_faith",
"lukas/united_in_faith",
"lukas/uif",
"lukas735/uif",
None of this worked... The regex proofer said the forward slash is placed wrong... But its composer intern so i can't change anything on that. And anyway. My strings also not got matched if i corrected that in regex proofer.
Is there anyway to let match my united-in-faith String... The name before was just an account name because a video said this vendor-name can be choosed yourself... But video was from 2016. I found no hints in internet where to find the vendor-name. So i choosed it myself.
I saw some videos and topics about this naming convention, but they all not seemed to giving an answer which solved it.
What did I wrong?
Has anybody a solution for this error?
Here is my Composer.json File:
{
"name":"lukas735/united-in-faith",
"description":"description",
"keywords": [
"united-in-faith",
"united in faith",
"united_in_faith",
"dating"
],
"homepage": "https://...",
"license": "MIT",
"authors": [
{
"name": "...",
"email": "....",
"homepage": "...",
"role": "Developer"
}
],
"repositories":[
{
"type": "package",
"package": {
"name": "lukas735/united-in-faith",
"version": "1.0.0",
"source": {
"url": "https://github.com/...",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"components/jqueryui": "^1.12",
"united-in-faith": "dev-master"
},
"autoload": {
"psr-4": {
"lukas735\\": "sites/classes"
}
},
"recommend":{
"ext-zip":"*"
},
"bin":["bin"],
"config":{
"vendor-dir":"vendor"
},
"scripts": {
"test": "phpspec run",
"format": "phpcbf --standard=psr2 src/"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
}
}
use command 'composer init' to make a new composer.json file, use old for reference
I modified a symfony 4 bundle to fix some bug. I now want to deploy my project through https://deployer.org/.
So I added this bundle not ignored in the .gitignore so that the folder of the bundle with my modifications is available on my github repo.
When executing the "deploy" command of deployer, it executes the command "/composer.phar install --verbose --prefer -dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest" so that the folder of my bundle edit is overwritten by the original bundle folder from https://packagist.org/.
I would like to modify my composer.json to define the path of my modified bundle and that it is not overwritten.
Here is what I tried in the composer.json of my main project:
{
"type": "my-project",
"license": "proprietary",
"repositories": [
{
"type": "path",
"url": "/vendor/my/modifiedBundle",
"packagist.org": false,
}
],
"require": {
......
"my/modifiedBundle": "0.6.1",
......
},
"require-dev": {
.....
},
"config": {
"preferred-install": {
"my/modifiedBundle": "source",
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
....
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": true,
"require": "4.3.*"
}
}
}
Here is the composer.json of my modified bundle:
{
"name": "my/modifiedBundle",
"type": "symfony-bundle",
"license": "MIT",
"require": {
...
},
"require-dev": {
...
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"my\\modifiedBundle\\": ""
}
},
"autoload-dev": {
"psr-4": {
"my\\modifiedBundle\\Tests\\": "tests/"
}
}
}
But after my modifications, the modified bundle is still overwritten by the original bundle, do you have any idea?
#Skros2 solved his problem on:
Fork the bundle to its own repository
Edit the fork
Refer his fork on his composer.jsonproject
how to refer a fork.
{
"repositories": [
{
"type": "git",
"url": "https://github.com/foobar/intermediate.git"
},
{
"type": "pear",
"url": "http://pear.foobar.repo",
"vendor-alias": "foobar"
}
],
"require": {
"foobar/TopLevelPackage1": "*",
"foobar/TopLevelPackage2": "*"
}
}
I'm trying using Azure DSC to pass a encrypted parameter to xpackage like so
azureDeploy.json
"parameters": {
"appPassword": {
"type": "securestring",
},
}
...
"resources": [
{
"type": "extensions",
"name": "DSC",
"apiVersion": "2015-06-15",
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.20",
"protectedSettings": {
"appPassword": "[parameters('appPassword')]",
"configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]",
"artifactsLocationSasToken": "[parameters('_artifactsLocationSasToken')]"
}
}
configuration.ps1
Configuration vm
{
param (
appPassword
)
...
xPackage app
{
...
Arguments = "/S /v`"/qn ADMIN_USER_PASSWORD=$appPassword`""
}
However when I do this, the "ADMIN_USER_PASSWORD" value is not set to parameter. If I passed the same parameter under settings it works.
Please see the Azure DSC Extension JSON blog
The corrected JSON would be:
"parameters": {
"appPassword": {
"type": "securestring",
},
}
...
"resources": [
{
"type": "extensions",
"name": "DSC",
"apiVersion": "2015-06-15",
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.20",
"protectedSettings": {
"configurationArguments": {
"appPassword": "[parameters('appPassword')]"
},
"configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]",
"artifactsLocationSasToken": "[parameters('_artifactsLocationSasToken')]"
}
}
Note, I haven't had time to test this. I reviewed the code and it looks like this should work.
I have a custom Wordpress theme hosted on Bitbucket that I'd like installed into the /themes directory in Wordpress when I run composer install.
I've played around with different repo 'types' e.g. vcs, package etc and I get errors for everything I've tried so far.
Here's a sample of my (not working) composer.json file:
{
"authors": [
{
"name": "Joe Bloggs",
"homepage": "http://www.example.com/"
}
],
"keywords": [
"wordpress", "composer", "wp"
],
"config": {
"secure-http": false
},
"repositories": [
{
"type": "composer",
"url": "http://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "wordpress/wordpress",
"version": "4.5.3",
"type": "webroot",
"dist": {
"type": "zip",
"url": "https://wordpress.org/wordpress-4.5.3.zip"
},
"require" : {
"fancyguy/webroot-installer": "1.1.0"
}
}
},
{
"type": "vcs",
"url": "https://bitbucket.org/gurtfrobe/plunderscores.git"
}
],
"require": {
"php": ">=5.3.2",
"wordpress/wordpress": "4.5.3",
"fancyguy/webroot-installer": "1.1.0",
"composer/installers": "v1.0.12",
"gurtfrobe/plunderscores": "1.0.1"
},
"extra": {
"installer-paths": {
"wp/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
"wp/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"wp/wp-content/themes/{$name}/": ["type:wordpress-theme"]
},
"webroot-dir": "wp",
"webroot-package": "wordpress/wordpress"
}
}
I've also tried the following with no luck:
{
"type": "package",
"package": {
"name": "gurtfrobe/plunderscores.git",
"version": "1.0.1",
"type": "wordpress-theme",
"source": {
"url": "https://bitbucket.org/gurtfrobe/plunderscores.git",
"type": "vcs",
"reference": "master"
}
}
},
Is there a way of achieving this without submitting my theme to wpackagist?
I solved it with this article.
Remember to push the latest version tags after you've updated your composer.json file. Otherwise Composer will still try and download a previous version.
I trying to implement angular-gird using Browserify.
I used a configuration like this:
{
"name": "Project",
"description": "Description",
"version": "0.0.1",
"repository": "...",
"license": "License",
"private": true,
"dependencies": {
"angular": "1.3.15",
"angular-ui-router": "0.2.14",
"angular-grid": "1.2.0"
},
"devDependencies": {
"browserify": "9.0.8",
"browserify-shim": "3.8.5",
},
"browserify": {
"transform": [
"browserify-shim"
]
},
"browser": {
"angular": "./client/app/common/angular-lib.js",
},
"browserify-shim": {
"angular-ui-router": {
"depends": "angular"
},
"angular-grid": {
"depends": "angular"
}
}
}
But then I get the error:
"Uncaught TypeError: require.config is not a function" (main.js).
Can someone help me? What is the best way to implement angularGrid with Browserify?