psl icon indicating copy to clipboard operation
psl copied to clipboard

documentation

Open azjezz opened this issue 2 years ago β€’ 28 comments

current documentation is mostly useless, as the same could be achieved by simply browsing through src/Psl directory.

Plan:

  • write better documentation using markdown
  • each component should be documented on it's own, with examples.
  • each component documentation should include all symbols defined within the component.
  • deploy documentation using GitHub pages.

Task list:

azjezz avatar Nov 08 '21 06:11 azjezz

documentation repository: https://github.com/php-standard-library/php-standard-library.github.io documentation url: https://php-standard-library.github.io

azjezz avatar Nov 08 '21 07:11 azjezz

channel component documentation has been written πŸŽ‰ https://php-standard-library.github.io/#/components/channel/

azjezz avatar Dec 03 '21 15:12 azjezz

class, interface, trait, and html components are now documented πŸŽ‰

https://php-standard-library.github.io/#/components/class/ https://php-standard-library.github.io/#/components/interface/ https://php-standard-library.github.io/#/components/trait/ https://php-standard-library.github.io/#/components/html/

azjezz avatar Dec 03 '21 19:12 azjezz

shell component is now documented:

https://php-standard-library.github.io/#/components/shell/

azjezz avatar Dec 03 '21 22:12 azjezz

Been through the links above: very clear explanations. Haven't really found any typos at this point either πŸ™‚

veewee avatar Dec 04 '21 07:12 veewee

pseudo-random, and secure-random components are now documented:

https://php-standard-library.github.io/#/components/pseudo-random/ https://php-standard-library.github.io/#/components/secure-random/

azjezz avatar Dec 04 '21 19:12 azjezz

runtime component is now documented:

https://php-standard-library.github.io/#/components/runtime/

azjezz avatar Dec 04 '21 21:12 azjezz

shell exceptions are now documented:

https://php-standard-library.github.io/#/components/shell/?id=exceptions

azjezz avatar Dec 04 '21 21:12 azjezz

@veewee wanna take care of Fun and Regex? i think you would be better at explaining those.

azjezz avatar Dec 04 '21 21:12 azjezz

json component is now documented:

https://php-standard-library.github.io/#/components/json/

azjezz avatar Dec 04 '21 22:12 azjezz

iter component is now documented:

https://php-standard-library.github.io/#/components/iter/

azjezz avatar Dec 05 '21 01:12 azjezz

@veewee wanna take care of Fun and Regex? i think you would be better at explaining those.

I don't mind, but am a bit limited in OS time the coming 2 months. We're working hard on a tight deadline.

Fyi : Gonna mark every page I proof-read with an emoji to keep track :)

veewee avatar Dec 05 '21 07:12 veewee

I just added inline-code-highlight docsify plugin to the documentation.

This helps 99% of the time, and makes things more readable, e.g:

examples of before/after

Html before: image

Html after: image

Shell before: image

Shell after: image

However, a big disadvantage is that it breaks for signatures such as Iter\apply<T>(iterable<T> $iterable, (callable(T): void) $callback): void;

everything gets highlighted correctly, except the Ìter\apply<T> part:

image

so to get around this, i moved the generic templates declaration before the function name, so now it looks like this:

image

It looks a bit weird, but works, and it's the only option i could come up with at the time.

personally, i don't see it as an issue since before signatures are not real, but rather put in place to help people understand the function behavior.

If anyone has a better option, I'm open for suggestions.

commit: https://github.com/php-standard-library/php-standard-library.github.io/commit/c40c7299df4f4640fc52ff669c217d97eb8db370

azjezz avatar Dec 06 '21 02:12 azjezz

Would it make sense to introduce an attribute for annotating the generics in the docs? It might be less confusing for PHP developers?

veewee avatar Dec 06 '21 08:12 veewee

couple of solutions:

image

image

image

azjezz avatar Dec 06 '21 17:12 azjezz

i think @template works great.

i also did some modification to remove list style type, and add a bottom border for each symbol definition.

before: image

after:

image

azjezz avatar Dec 06 '21 17:12 azjezz

another update:

each symbol now has a border around it to make it look like a box, the next step would be to give these "boxes" unique ids, and add a "link" button, so people can share links to a specific symbol in the documentation.

image

azjezz avatar Dec 06 '21 19:12 azjezz

Yes, @template works well indeed. Would it also make sense to add @pure instead of showing it in those separate info elements?

veewee avatar Dec 06 '21 20:12 veewee

yea, i think that would work, same for @mutation-free, @external-mutation-free, and @immutable

azjezz avatar Dec 06 '21 20:12 azjezz

done πŸŽ‰ image

azjezz avatar Dec 06 '21 21:12 azjezz

async component is now documented:

https://php-standard-library.github.io/#/components/async/

azjezz avatar Dec 08 '21 21:12 azjezz

HI @azjezz, I think it could be useful to add some documentation about why using this library (or maybe I missed it). For instance, I saw a PR https://github.com/Roave/BackwardCompatibilityCheck/pull/306 removing some libraries in favor of this one, and I was kinda curious about why this change was worth it.

So for instance, as a developper using webmozart/assert currently, would I have some benefit to change ?

VincentLanglet avatar Dec 16 '21 20:12 VincentLanglet

I think that would be a nice addition, but currently it's not a high priority, as it's more important to document components then writing a comparison.

azjezz avatar Dec 17 '21 11:12 azjezz

fun, and promise components are now documented:

https://php-standard-library.github.io/#/components/promise/ https://php-standard-library.github.io/#/components/fun/

azjezz avatar Dec 18 '21 18:12 azjezz

TCP component is now documented:

https://php-standard-library.github.io/#/components/tcp/

azjezz avatar Dec 18 '21 20:12 azjezz

Unix component is now documented:

https://php-standard-library.github.io/#/components/unix/

azjezz avatar Dec 18 '21 20:12 azjezz

Fyi : The docs web site on my phone tries to display the content in about half the available screen size. It is due to the borders and the margins. It is a bit annoying, not sure if other people will read it on the phone though πŸ˜‰

veewee avatar Dec 18 '21 20:12 veewee

Yea, I'm aware of that issue, i will try fixing it after finishing up the documentation ( though, I am not really good with CSS stuff :p )

azjezz avatar Dec 19 '21 14:12 azjezz