php

New domain

planet PHP - 2019-03-07(木) 23:10:00

I've had the domain leftontheweb.com for ages. It's been with me since 2004. However, since I recently got a brand new .dev domain, I decided it was time for a change. Since I can't even remember how I came up with the old name, it's time for a change. A new name that is easy to recognize, easy to remember and easy to link to me.

The new domain name for this blog is:

skoop.dev

It only makes sense to switch to this domain. Skoop has been my nickname for as long as I have access to the Internet. And since my main occupation is still development, this switch makes sense.

Now, to find interesting topics to blog about again...

カテゴリー: php

PHP 7.1.27 Released

php.net - 2019-03-07(木) 20:49:58
カテゴリー: php

PHP 7.2.16 Released

php.net - 2019-03-07(木) 19:08:52
カテゴリー: php

PHP 7.3.3 Released

php.net - 2019-03-07(木) 18:10:40
カテゴリー: php

PHP 7.2.16 Released

planet PHP - 2019-03-07(木) 09:00:00
The PHP development team announces the immediate availability of PHP 7.2.16. This is a security release which also contains several minor bug fixes.All PHP 7.2 users are encouraged to upgrade to this version.For source downloads of PHP 7.2.16 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
カテゴリー: php

PHP 7.1.27 Released

planet PHP - 2019-03-07(木) 09:00:00
The PHP development team announces the immediate availability of PHP 7.1.27. This is a security release which also contains several bug fixes.All PHP 7.1 users are encouraged to upgrade to this version.For source downloads of PHP 7.1.27 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
カテゴリー: php

PHP 7.3.3 Released

planet PHP - 2019-03-07(木) 09:00:00
The PHP development team announces the immediate availability of PHP 7.3.3. This is a security release which also contains several bug fixes.All PHP 7.3 users are encouraged to upgrade to this version.For source downloads of PHP 7.3.3 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
カテゴリー: php

Interview with Jeremy Lindblom

planet PHP - 2019-03-06(水) 21:00:00

@jeremeamia Show Notes

Audio

This episode is sponsored by


The post Interview with Jeremy Lindblom appeared first on Voices of the ElePHPant.

カテゴリー: php

414 URI Too Long

planet PHP - 2019-03-06(水) 00:00:00

The URI or path of a HTTP request doesn’t have any hard limits in terms of how long it’s allowed to be.

However, Browsers and search engines have limits, and on the server side it’s a good idea to limit the length of the URI to combat certain denial-of-service attacks or bugs.

Based on limits of browsers, it’s a good idea to try and not exceed 2000 bytes for the uri.

When a client does exceed it, the appropriate status code to return is 414 URI Too Long.

Example HTTP/1.1 414 URI Too Long Content-Type: text/html <p>Insufficient level of conciseness in request</p> References
カテゴリー: php

Retiring PHP's Mirror Program

planet PHP - 2019-03-05(火) 23:15:00
Retiring PHP's Mirror Program
London, UK Tuesday, March 5th 2019, 14:15 GMT

The PHP.net website has in the last 20 years made use of an extensive network of mirrors to make the PHP documentation available, and distribute source tarballs. These mirrors have been maintained by members and companies in the PHP eco-system for many valuable years. However, the administration of the mirror system is often haphazard, with few contributors helping out—PHP is Open Source, and this is simply how these things can go.

Maintaining the mirrors is now no longer sustainable, and also hinders the take up of moving the PHP.net website fully to HTTPS. Because the PHP.net team has no access to the mirror servers, we also can't make sure the mirrors are up-to-date, and some mirrors are still running PHP 5.3.

It is likely no longer necessary to have a mirror system in place, as unlike 20 years ago, it is not nearly has hard as setting up a distributed cache system. As a matter of fact, some of the PHP.net web site, through http://www.php.net/, already sits behind a Content Delivery Network (CDN) from Myra, which is sponsored by long time PHP contributor Sascha Schumann.

With these preliminaries out of the way, I would therefore like to announce the discontinuation of PHP.net's mirroring program. Instead of having mirrors, we are moving all of PHP.net to HTTPS (and get rid of https://secure.php.net), and move them behind Myra's CDN, with the same local content delivery opportunities, but at significantly less administration requirements.

Watch this space for further developments!

To end this post, I would very much like to thank all the mirror maintainers for their dedication, time, and bandwidth over all these years. Thanks!

カテゴリー: php

Croissants in Québec

planet PHP - 2019-03-05(火) 16:00:00
カテゴリー: php

10 Years of thePHP.cc

planet PHP - 2019-03-05(火) 16:00:00
カテゴリー: php

Hand-written service containers

planet PHP - 2019-03-04(月) 19:45:00

You say "convention over configuration;" I hear "ambient information stuck in someone's head." You say "configuration over hardcoding;" I hear "information in a different language that must be parsed, can be malformed, or not exist."

— Paul Snively (@paul_snively) March 2, 2019

Dependency injection is very important. Dependency injection containers are too. The trouble is with the tools, that let us define services in a meta-language, and rely on conventions to work well. This extra layer requires the "ambient information" Paul speaks about in his tweet, and easily lets us make mistakes that we wouldn't make if we'd just write out the code for instantiating our services.

Please consider this article to be a thought experiment. If its conclusions are convincing to you, decide for yourself if you want to make it a coding experiment as well.

The alternative: a hand-written service container

I've been using hand-written service containers for workshop projects, and it turns out that it's very nice to work with them. A hand-written service container would look like this:

final class ServiceContainer { public function finalizeInvoiceController(): FinalizeInvoiceController { return new FinalizeInvoiceController( new InvoiceService( new InvoiceRepository( $this->dbConnection() ) ) ); } private function dbConnection(): Connection { static $connection; return $connection ?: $connection = new Connection(/* ... */); } }

The router/dispatcher/controller listener, or any kind of middleware you have for processing an incoming web request, could retrieve a controller from the service container, and call its main method. Simplified, the code would look this:

$serviceContainer = new ServiceContainer(); if ($request->getUri() === '/finalize-invoice') { return $serviceContainer->finalizeInvoiceController()->__invoke($request); } // and so on

We see the power of dependency injection here: the service won't have to fetch its dependencies, it will get them injected. The controller here is a so-called "entry point" for the service container, because it's a public service that can be requested from it. All the dependencies of an entry-point service (and the dependencies of its dependencies, and so on), will be private services, which can't be fetched directly from the container.

There are many things that I like about a hand-written dependency injection container. Every one of these advantages can show how many modern service containers have to reinvent features that you already have in the programming language itself.

No service ID naming conventions

For starters, service containers usually allow you to request services using a method like get(string $id). The hand-written container doesn't have such a generic service getter. This means, you don't have to think about what the ID should be of every service you want to define. You don't have to come up with arbitrary naming conventions, and you don't have to deal with inconsistent naming schemes in a legacy single project.

The name of a service is just the name of its factory method. Choosing a service name is therefore the same as choosing a method name. But since every method in your service container is going to create and return an object of a given type, why not use that type's name as the name of the method? In fact, this is what most service containers have also started doing at some point: they recommend using the name of the class you want to instantiate.

Type-safe, with full support for static analysis

Several years ago I was looking for a way to check the quality of the Symfony service definitions that I wrote in Yaml. So I created a tool for validating service definitions created with the Symfony Dependency Injection Component. It would inspect the service definitions and find out if they had the right number constructor arguments, if the class name it referenced actually existed, etc. This tool helped me catch several issues that I would only have been able to find out by clicking through the entire web application.

Instead of doing complicated and incomplete analysis after writing service definitions

Truncated by Planet PHP, read more at the original (another 13461 bytes)

カテゴリー: php

Bulgaria PHP Conference 2019

php.net - 2019-03-03(日) 20:37:07
カテゴリー: php

User Roles and Access Control (ACL) in Laravel

planet PHP - 2019-03-03(日) 11:37:00

It's been over a year since I covered how to protect adminpanel routes in Laravel using Gates. Some people kept reminding me about my promise to cover ACL and user roles, and I kept putting off fulfilling that promise.

Finally I run into that on one of my projects, and that's the sign I was waiting for to continue giving back to the community I learned so much from.

What is ACL

Although some computer science theorists like to throw baffling definitions of the term into people (looking at you, MSDN), in reality it's pretty simple and straightforward. ACL stands for Access Control List, and specifies what users are allowed to do.

There are three entities in the ACL:

  • User Role: e.g. admin, editor, reader
  • Object: e.g. blog post
  • Operation: create, edit, read, etc.

Continue reading
カテゴリー: php

413 Payload Too Large

planet PHP - 2019-02-27(水) 00:00:00

The 413 Payload Too Large response is used when the client sent a request with a body that’s too big.

Maybe the request was a file upload, and it exceeded the maximum file-size, or maybe it’s an API and it preemptively blocks requests that are unrealisticly large.

It’s a good idea to try and think of reasonable limits for requests, as accepting arbitrary-size HTTP requests could result in denial-of-service attacks.

If this error is temporary, a server can include a Retry-After header to indicate to the client they should just try again after a certain amount of time.

One example of a temporary status could be that the client has an upload-quota and it was exceeded.

If the reason for the error is that the server ran out of disk- space, 507 Insufficient Storage should be used instead.

Example HTTP/1.1 413 Payload Too Large Content-Type: text/html <p>This endpoint does not support requests larger than 1MB</p> HTTP/1.1 413 Payload Too Large Retry-After: 3600 Content-Type: text/html <p>You exceeded your quota. Try again in an hour</p> References
カテゴリー: php

Interview with Joind.in Maintainers

planet PHP - 2019-02-26(火) 22:00:00
カテゴリー: php

In defense of the office

planet PHP - 2019-02-25(月) 05:49:00
In defense of the office

It is trendy these days to extol the virtues of remote working, and either implicitly or explicitly shame any company/manager that doesn't like it. While there are absolutely advantages to remote work or working from home, the one-sidedness of the conversation is, I believe, actively harmful. The idea of "going to work" is still a valid and useful one, and one that should not be cavalierly cast aside in Twitter snark the way it currently is.

Continue reading this post on SteemIt.

Larry 24 February 2019 - 2:49pm
カテゴリー: php

Quelques livres lus en 2018

planet PHP - 2019-02-21(木) 09:00:00
Deux mois en retard, j’ai fait le tour des livres que j’ai lus en 2019. J’en ai déjà recommandé plusieurs autour de moi et, en parcourant mes lectures de ces derniers mois, j’en ai vu d’autres dont je n’ai jamais parlé mais qui étaient tout aussi intéressants. Voici donc quelques livres que j’ai lus en 2018 et que je recommande. Why we sleep — Matthew Walker Pour commencer, Why we sleep est un livre très intéressant sur le sommeil (j’avais écrit un article à ce sujet il y a un moment, d’ailleurs).
カテゴリー: php

It depends

planet PHP - 2019-02-20(水) 22:00:00

When I was younger, I had strong opinions about many subjects. I felt I was right about a great many things, and anyone who disagreed with me was wrong. In my mind there was a right or a wrong, a black and a white, with little room for grey. Others were certainly entitled to their […]

The post It depends appeared first on BrandonSavage.net.

カテゴリー: php

ページ