PHP Documentor --output option - php

I have installed PHP Documentor through PEAR. but output option is not working.
when i use simple command like
phpdoc -d source/path -t target/path --template responsive
it works fine. but when i use -o or --output option like this
phpdoc -d source/path -t target/path -o PDF:default:*
it gives following error.
[RuntimeException]
The "-o" option does not exist.
i have tried other output formats as well like -o HTML:Smarty:PHP and -o HTML:Smarty:default but the result is same.

the -o option does not exist on phpdocs 2
Look option whit:
phpdoc -h

In the new version 2. * yet there is no such pdf template. There is not also the option -o.
there are only http://www.phpdoc.org/templates
template selection
phpdoc --template="clean" --template="checkstyle" -d .
BTW I use the older version (1.4.4) I wanted to save to pdf.
phpdoc -o PDF:default:default -t ./docs -d ./
But created an bad document. Maybe version 1.4.4 does not work with PHP 5.5.11 on the issue in PDF format.
I managed in version 1.4.4 only generate HTML.
phpdoc -o HTML:frames:earthli -t ./docs -d ./
So I went back to version 2 * and I wait pdf template.

Related

docker: invalide reference format [duplicate]

I'm following this tutorial that uses Docker. When I tried to run Docker (inside the run.sh script):
docker run \
-p 8888:8888
-v `pwd`/../src:/src \
-v `pwd`/../data:/data -w /src supervisely_anpr \
--rm \
-it \
bash
I got the error:
docker: invalid reference format.
I spent 2 hours and I can't really understand what's wrong. Any idea really appreciated.
In powershell you should use ${pwd} instead of $(pwd)
The first argument after the "run" that is not a flag or parameter to a flag is parsed as an image name. When that parsing fails, it tells you the reference format, aka image name (but could be an image id, pinned image, or other syntax) is invalid. In your command:
docker run -p 8888:8888 -v `pwd`/../src:/src -v `pwd`/../data:/data -w /src supervisely_anpr --rm -it bash
The image name "supervisely_anpr" is valid, so you need to look earlier in the command. In this case, the error is most likely from pwd outputting a path with a space in it. Everything after the space is no longer a parameter to -v and docker tries to parse it as the image name. The fix is to quote the volume parameters when you cannot guarantee it is free of spaces or other special characters.
When you do that, you'll encounter the next error, "executable not found". Everything after the image name is parsed as the command to run inside the container. In your case, it will try to run the command --rm -it bash which will almost certainly fail since --rm will no exist as a binary inside your image. You need to reorder the parameters to resolve that:
docker run --rm -it -p 8888:8888 -v "`pwd`/../src:/src" -v "`pwd`/../data:/data" -w /src supervisely_anpr bash
I've got some more details on these two errors and causes in my slides here: https://sudo-bmitch.github.io/presentations/dc2018/faq-stackoverflow-lightning.html#29
I had the same issue when I copy-pasted the command. Instead, when I typed-in the entire command, it worked!
Good Luck...
I ran into this issue when I didn't have an environment variable set.
docker push ${repo}${image_name}:${tag}
repo and image_name were defined but tag wasn't.
This resulted in docker push repo/image_name:.
Which threw the docker: invalid reference format.
I had a similar problem.
Issue I was having was $(pwd) has a space in there which was throwing docker run off.
Change the directory name to not have spaces in there, and it should work if this is the problem
I was having the same problem on Linux. That was because of directory names contained spaces. I fixed it by using "$(pwd)/path/to/go" instead of $(pwd)/path/to/go
I was executing the whole command in one line, as it was mentioned as such
$ docker run --name testproject-agent \
-e TP_API_KEY="REPLACE_WITH_YOUR_KEY" \
-e TP_AGENT_ALIAS="My First Agent" \
testproject/agent:latest
But its supposed to be a multiline command, and I copied the command line by line and pressed enter after every line and bam! it worked.
Sometimes when you copy off of the web, the new-line character gets omitted, hence my suggestion to try manually introducing the new line.
For others come here:
If you happen to put your docker command in a file, say run.sh, check your line separator. In Linux, it should be LR, otherwise you would get the same error.
In my case, the command was like this
docker run -d --name kong-database \
--network=kong-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kongpass" \
postgres:9.6
I was trying to copy everything in a single line including slash (\) and was getting the following error
docker: invalid reference format.
The slash (\) in the command indicates the next line, so if you are trying to run the complete command in a single line just remove the slash (\), it worked for me
Thanks :)
I was using a very generic command
docker build .
It turned out that I needed to just specify the tag name otherwise there was no name to use
docker build . -t image_name
And then it worked.
Found that using docker-compose config reported what the problem was.
In my case, an override compose file with an entry that was overriding nothing.
I removed () and worked for me like this
docker run -d -v $pwd/envoy.yaml:/etc/envoy/envoy.yaml:ro -p 8080:8080 -p 9901:9901
I am using windows 10
This also happens when you use development docker compose like the below, in production. You don't want to be building images in production as that breaks the ideology of containers. We should be deploying images:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
Change that to use the built image:
web:
command: /bin/bash run.sh
image: registry.example.com:9000/dyndns_api_web:0.1
ports:
- "8000:8000"
I was getting the same issue while using $(pwd) through powershell, I replaced it with ${pwd} and it worked for me.
Following are the details for the same:
PS C:\Users\Systems\git\mastery\dockerfile> docker container run -d --name nginx -p 8080:80 -v $(pwd):/usr/share/nginx/html nginx
docker: invalid reference format.
See 'docker run --help'.
PS C:\Users\Systems\git\mastery\dockerfile> docker container run -d --name nginx -p 8080:80 -v ${pwd}:/usr/share/nginx/html nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
Digest: sha256:25975292693bcc062becc20a1608936927f9950a42fb4474088f6292dacd4ec9
Status: Downloaded newer image for nginx:latest
f6ff08ed3b73095e85474bd2f248a7cae6b5bcdb53e12e4824d235df3cd268aa
In my case the problem is in the full path to folder with repo where I use terminal & docker. I was something like this:
repo (1)/repo/
so rename folder to
repo/repo
and it will help
Sometimes the problem is an additional whitespace at the end of line.
Bad: 😭
-v "$(pwd)/../src:/src" \
Spaces at the end!
Good: 🤩
-v "$(pwd)/../src:/src" \
Only newline after the slash!
Bonus hint: Some editors (like VSCode) give a different color to a slash followed with a whitespace.
One of the problems I had is that in my configs of skaffold config list -a, my default-repo was set to https://docker-registry.url.com as seen below:
kubeContexts:
- kube-context: minikube
default-repo: https://docker-registry.url.com
but instead, the correct way should have been without https://:
kubeContexts:
- kube-context: minikube
default-repo: docker-registry.url.com
Run it on CMD instead of PowerShell if you are using Windows.
In case anyone else hits it, yet another variant that results in this error is caused by a trailing / or \ on your path specification.
i.e. -v c:\mystuff:c:\mappedfolder works
but: -v c:\mystuff\:c:\mappedfolder does not
Where there is the extra "\" at the end of mystuff
So in my case, the problem was that the command was "illegal", aka. in a format that was not supported, which was the last thing expected since I found it in the official documentation, but it is what it is. Make sure you are using the right command.
Another case when this can show up is when you're missing the image to be run.
Just a heads-up: if any folder of you path has a space in it, remove it. For example if one of the folder's name is my folder, change it into my-folder.
If you run the script in windows PowerShell you need to replace $(pwd) to ${pwd} with curly brackets.
Remove the \ and just write your command continuously.
Write it like this
docker run -p 8888:8888 -v `pwd`/../src:/src -v `pwd`/../data:/data -w /src supervisely_anpr --rm -it bash
instead of
docker run \
-p 8888:8888
-v `pwd`/../src:/src \
-v `pwd`/../data:/data -w /src supervisely_anpr \
--rm \
-it \
bash

swagger-codegen or openapi-generator PHP version

The actual question: is it possible to choose the PHP version (5.6, 7.1, 7.2, ...) to generate code?
I got a swagger.json from https://api.otto.market/docs
which should be an openapi.json or so, since the file contains "openapi": "3.0.3",. Anyway ...
What i found out so far is that they (swagger and openapi-generator) seem to have templates for the code generation.
And those templates are written in the language for the version in use.
F.e. this (openapitools/openapi-generator-cli)
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/path/to/swagger.json \
-g php \
-o /local/path/to/generated/code/
creates a composer.json with
...
"require": {
"php": "^7.3 || ^8.0",
...
},
...
I now COULD use the templates and change the requirements.
But i think this would not be the target of a code generator.
Info about templates added to bottom.
What i guess is that there should be templates written for other PHP version.
But how would i choose them?
Are there any?
Swagger: as i read swagger came first, and openapi-generator is a fork.
So i tried swagger:
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \
-i /local/path/to/swagger.json \
-l php \
-o /local/path/to/generated/code/
Swagger created code for PHP 5.5 (as of the generated composer.json).
But it brings warnings and the generated code looks "broken".
I actually do not wonder since the file is made for openapi": "3.0.3.
But what i see is: swagger has templates for PHP 5.5.
My personal current conclusion:
I can generate code real quick f.e. for an API that i do not really (have to) know.
But how does it help me if i cannot change the language version?
F.e. i need an API client in 2 projects.
One is in PHP 7.1 and the other one in 7.3. How do i solve this?
Anybody had to deal with this? Or any ideas?
INFO
templates: how to use templates:
Call docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli author template -g php -o /local/templates/
to save all templates to path templates/.
You then can f.e. copy the composer.mustache to f.e. deploy/templates/ and change it.
On generating code you use -t /local/deploy/templates to use your changed template.
Example:
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/path/to/swagger.json \
-g php \
-o /local/path/to/generated/code/ \
-t /local/deploy/templates
Old versions of OpenAPI Generator (e.g. 3.0.0, 4.0.0) support old PHP versions.
To easily switch between OpenAPI Generator CLI versions, you may want to use the NPM CLI wrapper for OpenAPI Generator.

Phpdoc is not defined, but -V is work

I installed the phpdocumentator via composer.
But I have an error:
Command php composer.phar phpdoc -V is work
And yet I did not understand the message: No composer.json in current directory... But it is now in this directory. -ls confirms this fact
Shouldn't you be executing phpdoc this way:
./vendor/bin/phpdoc -d env/production -t env/autodoc ?
Your command appears to only be calling the -V version option of composer.phar, and doing nothing whatsoever with regard to phpdoc.

Create Standalone PHP 5.4 Binary

For offline development I would like to make make a standalone PHP 5.4 binary so I can use the PHP self hosting option.
eg php -S localhost:8000
Which would startup a server for hosting PHP files.
Since installing and configuring PHP 5.4 on mac is not trival for non tech people. I would like to be able to include a working PHP binary in my files. So essentially I can run.
./php -S localhost:8000 in my folder and it will work.
I have followed the instruction here to create a standalone PHP binary by running on the source code.
./configure --enable-static --enable-cgi --enable-mbstring\
--enable-force-cgi-redirect \
--with-config-file-path=/etc/php5cgi \
--prefix=/usr/local/php5cgi \
--with-curl \
--enable-sockets \
--with-zlib --with-zlib-dir=/usr/include \
--with-pear
Then editing the Makefile to have -all-static
BUILD_CGI = <other commands here> $(ZEND_EXTRA_LIBS) -all-static -o $(SAPI_CGI_PATH).
BUILD_CLI = <other commands here> $(ZEND_EXTRA_LIBS) -all-static -o $(SAPI_CGI_PATH).
This does work. File is standalone.
But when I run the binary.
./php-cgi -h
There is no "-S" option for the built in webserver?
Do I need to change something in my configure options to allow the builtin webserver? My source was downloaded from PHP.net (I did download the 5.5 latest source, but that still does have the -S option).
Thanks, John.
thanks to #devZer0
I cd'ed into
sapi/cgi/php-cgi
and tried to run this.
Needed to cd into sapi/cli/php
That works now! php -h return the -S option for webserver.

how to run imagemagik commands in PHP?

i am trying to bend text using imagemagik in PHP. but the commands shown in the website are not working.
http://www.fmwconcepts.com/imagemagick/texteffect/index.php
how can i run these scripts in PHP ? somebody please help me..
NB :-t \'SOME ARCHBOTTOM TEXT\' -s outline -e arch-bottom -d 1.0 -f Arial -p 48 -c skyblue -b white -o black -l 1 -u lightpink
Translate them to the PHP ImageMagick API
dear you can use exec or passthru command to run image magic commands in php, no need of any API, just installed the latest imagemagick, if you are searching on php.net site the you will det the message like "Not documented"..
Are you using magickwand? I had a similar problem, I didn't have my PHP installation properly configured to use Imagemagick. This link helped
http://www.ioncannon.net/php/75/how-to-compile-imagemagick-for-php-by-hand/

Categories