πŸ‘Ύ your cto
19 subscribers
2 photos
13 links
Channel about development and CTO daily stuff. In russian: @techdir

Contact me: @ilya0
Download Telegram
Channel created
Hi! I'm Komitet CTO Ilya Chekalskiy and this is my channel about modern PHP and about some developing, DevOps and CTO stuff.

Komitet is a russian media company which manages vc.ru, tjournal.ru, dtf.ru and spark.ru. First three of them working on Osnova (it means the Basis in russian) β€” our modular media platform.

Write me on Telegram @ilya0
https://chekalskiy.ru/
We are using Monolog for logging because PSR-3 is a standard for a long time for every libraries (except Facebook's, lol). All logs writes in a rotated text file and also going to a server. Firstly we used Rollbar but after their price changes we started to use Sentry and it's very hot! Now we spending about $30 per month on it.

Sentry can logs not only backend errors, but also on a frontend. For every issue we have full information β€” when, where and with wich conditions it mets. We can also see the full tracelog. Usually with that we can fix it in a minutes. Similar errors are grouping up and flexible alert system allows us to recieve all new errors in the Slack.

https://sentry.io/
#debug #logging #psr3
I can't imagine my life without PHP CodeStyle Fixer and here is why.

https://github.com/FriendsOfPHP/PHP-CS-Fixer

This thing automatically makes your code PSR-1 & PSR-2 compatible, cleans spaces, makes arrays shorter ([] instead of array()) and makes code written by different developers looks similar. Further reading will be easier and it's lowering CTO butthurt level about exess spaces before the if.

This tool has a plugin for every popular IDE so you can make code looks perfect just by pressing the hotkey. Or even on every save. But it's too much. Just by hotkey is OK.

Here is our config which are we using. You could use it but don't forget to read the docs.
https://gist.github.com/chekalskiy/c79c77657a18419125c72c86fe333b86

#library #php #psr2
Not everybody knows that Composer has a lot of plugins which makes our life easier. Here are some of my favorites.

β€’ Versions Check β€” shows outdated packages.
β€’ Changelogs β€” show changelog links of updated packages.
β€’ Prestissimo β€” parallel packages loading.

More you can find in Awesome Composer list.
#composer #library
GitHub opens integrations marketplace

https://github.com/marketplace

You can integrate with Travis CI, Codecov, Dependabot, Sentry, Blackfire and many more in a couple clicks often on a special price. And all of them paid with your or your company's account on GitHub. For me this marketplace is useful because of list of all modern trandy SaaS-services. Btw there is another one list like this β€” Slack marketplace.

#saas
​​And Composer again. If you like to make all the packages in composer.json being sorted by their names and doing it every time by your hands then I've got a very good news for you. You can just add "sort-packages": true into the config section in the file and composer require will automatically sort your packages list alphabetically.

And if you prefer to load dists then you can also add a paramater for that. You can find more setting in the docs (https://getcomposer.org/doc/06-config.md).

#composer
If your API documentation is perfectly fine (ha-ha) in a API Blueprint or Swagger format then Dredd could be helpful for you. This tool for checking API responses could not only check response code, but also check JSON fields types to match the API. And of cource you can integrate Dredd with your favourite CI tool.

And if documentation exists only in your head then it could be a good reason to start formalize it. BTW if you prefer SaaS then there is Runscope for that and it costs $79 per month.

I think that good to have both of this tools β€” API on your production server could be different from documentation not only because of bad code review, but also because of consistency problem like if you deleted the user from DB and didn't delete his comments due to some error.

#saas #testing #api
Brotli β€” is the new data compression algorithm from Google and in September a stable version were released. Here is four things you should know about algorithm which could replace gzip.

β€’ In some tests it is 20% more effective than gzip on speed and coefficient of compression.
β€’ There are libs for all modern web-servers. Here is, for nginx for example.
β€’ Since September brotli is supported by 70% market share browsers including last Safari.
β€’ Cloudflare recommends use gzip for small files Π°nd brotli for bigger ones (but article is quite old).

#devops #nginx
​​JSON5 is starting to take off.

It is a new JSON extension format making it more convenient to write by hands.

In JSON5 you can:
β€’ use comments,
β€’ use single quotes,
β€’ write keys without quotes at all,
β€’ add a trailing comma everywhere,
and many more.

PHP library

#php #library
Maybe I should start the channel with that link. It's very important start point for every PHP developer regardless of experience. Junior developer could save two year by reading and trying everything what is written there, Senior could look at things he knows from a different angle.

http://www.phptherightway.com/
Today we've found interesting bug β€” when nginx returns empty 524 A Timeout Occurred error response, Safari downloads empty .dms-file instead of showing some error page.

You can check it here: https://dtf.ru/test-524

There is simple config:
location /test-524 {
return 524;
}
About copy-paste again.

Today i've learned a difference between sprintf("%015.2F", $var) and sprintf("%015.2f", $var). In function which i've copied from first google search result was the second variant and suprisingly it's result depends from locale. It become clear only on stage server, where code cannot find the dot in the result.

#php
When your SaaS company is not ready for a new world.
​​Well, we still have more than a week.
Pretty interesting I think; Danny van Kooten writes that two years ago they moved from Laravel to Go because Go is great (and that's true) and now they are moving back to PHP (Symfony 4) because PHP is much more maintainable when you have a usual website.

I have thoughts about rewriting all our code to Go constantly, and I am trying to drive it away every time; because from a business perspective, it's an awful idea. So we are indulgу ourselves by writing small microservices on Go and taking a bath with static typing and goroutines.

https://dannyvankooten.com/from-go-back-to-php-again/