Monthly Archiv: January, 2022

8 CSS & JavaScript Snippets for Creating Reflection & Refraction Effects

The simple act of light reflecting off of or refracting through a surface can produce stunning visuals. We see it every day in the physical world. It might be the way the sun peeks through your office window or light hitting a mirror at just the right angle. They’re like little science experiments that take place right in front of us.

Thanks to the latest CSS and JavaScript techniques, these effects are also dazzling web users. Everything from relatively simple reflection details to light-bending refractions is popping up on our screens. Even highly-realistic behaviors are possible.

Today, we’ll introduce you to some outstanding code snippets that bring mirror, reflection, and refraction effects to life. Let’s take a look!

Bonsai animation by Kamil

This gently-animated bonsai provides a calming feel that belies the serious technology that makes it work. It utilizes SVG and the GSAP animation library to create a lovely water reflection effect.

See the Pen Bonsai animation by Kamil

PBR Reflection by ycw

Here’s a very unique snippet that features multiple effects. First, there’s a rotating shape that hovers in front of a mirror-like surface. Notice the shiny reflection underneath as well. The lighting and shading are gorgeous. You can also use your mouse or touch to change the perspective.

See the Pen PBR Reflection by ycw

Mirrored Light Orb Cursor Movement by Diana Le

This snippet is proof that mirror effects can be applied in unconventional ways. Two brightly-colored orbs appear against a black background. Move your cursor to take control of the left (white) one, while the other mirrors your movements. Dragging these orbs all over the screen in tandem is more fun than it should be!

See the Pen Mirrored Light Orb Cursor Movement by Diana Le

GLSL: Refracted rays by Liam Egan

The color and texture of this animation are mesmerizing. Rows upon rows of spheres move toward you, while your cursor position changes the refraction index. The look ranges from glassy to old-school television static. HTML 5 canvas and JavaScript are used to create the ultra-smooth movement.

See the Pen GLSL: Refracted rays by Liam Egan

Pure CSS text mirror by Tim

Mirrored text is surprisingly easy to implement. With just a few dozen lines of pure CSS, you can achieve an attractive effect that is sure to grab a user’s attention. The secret is in the CSS transform property, which flips the mirrored version upside down. From there, a gradient is used to create a more realistic look.

See the Pen Pure css text mirror by Tim

Text Refraction by Juan Fuentes

Add some custom text and this snippet will make it look as if it’s being viewed through a crystal ball. Cursor movements change both the perspective and size of the effect. When combined with the colorful background, the whole presentation has a 1960s vibe to it.

See the Pen Text Refraction by Juan Fuentes

Phone Reflection by Luke Lincoln

Check out this abstract take on a modern obsession – staring blankly into your phone. Click on the phone and simulated text reflects slowly up the subject’s body. It’s similar to what you might see in a darkened movie theatre.

See the Pen Phone Reflection by luke lincoln

Three.js Reflection by seanwasere

Speaking of abstract works, this virtual game board is something to behold. Mirrored 3D balls roll around as light bounces off of them. You can also change the perspective of the scene, adding even more intrigue to the outstanding special effects. If astronauts play games in space, this might be the one.

See the Pen Three.js Reflection by seanwasere

Adding a New Perspective to the Web

Amazing as it may seem, developers are crafting some seriously stunning mirror, reflection, and refraction effects for the web. Not only do they look incredible, but many also make great use of physics to add a layer of realism as well.

Want to see even more top-notch snippets? Take a peek at our CodePen collection!

The post 8 CSS & JavaScript Snippets for Creating Reflection & Refraction Effects appeared first on Speckyboy Design Magazine.

Saad Laravel PHP Fractal Transformer

Package:
Saad Laravel PHP Fractal Transformer
Summary:
Transform data presented by Laravel applications
Groups:
HTTP, Libraries, PHP 5
Author:
Ahmed Saad
Description:
This class can transform data presented by Laravel applications...

Read more at https://www.phpclasses.org/package/12363-PHP-Transform-data-presented-by-Laravel-applications.html#2022-01-23-23:45:38

PHP REST API Call without CURL

Package:
PHP REST API Call without CURL
Summary:
Send API HTTP requests using PHP file_get_contents
Groups:
HTTP, PHP 5, Web services
Author:
adam berger
Description:
This class can send API HTTP requests using PHP file_get_contents...

Read more at https://www.phpclasses.org/package/12362-PHP-Send-API-HTTP-requests-using-PHP-file-get-contents.html#2022-01-22-15:05:11

PHP Get Meta Tags from URL

Package:
PHP Get Meta Tags from URL
Summary:
Extract meta tags of a Web page with a given URL
Groups:
HTML, Parsers, PHP 5, Web services
Author:
Luis Toscano
Description:
This class can extract meta tags of a Web page with a given URL...

Read more at https://www.phpclasses.org/package/12361-PHP-Extract-meta-tags-of-a-Web-page-with-a-given-URL.html#2022-01-21-20:11:13

Podcast: Social Media Previews, Domain Name TLD Zone Files, and How Thieves Steal Domain Names

Bill Hartzer on Social Media Previews, Domain Name TLD Zone Files, and How Thieves Steal Domain Names

Bill Hartzer on Social Media Previews, Domain Name TLD Zone Files, and How Thieves Steal Domain Names

On the latest episode of the Digital Marketing Podcast with Bill Hartzer, I talked about social media and domain names. I then went into details about how to update the previews that social media sites use, such as Facebook and LinkedIn. Then I talked about getting domain name zone files for TLDs and what data is included in a zone file for a Top Level Domain. Then, I talked about stolen domain names and shows an example of a (allegedly) stolen domain name, and how that domain thief was able to take control over a valuable domain name by purchasing a lower-quality domain name that expired.

You can see the full video of the podcast episode, which includes views of my screen why I describe it.

Here is a transcript of this podcast episode:

Bill Hartzer (00:03):
Hi, this is Bill Hartzer and this is the Digital Marketing podcast with Bill Hartzer. Or the Digital Marketing with Bill Hartzer podcast for today is January 20th, 2022. Have a couple thi different things to share with you today. I’m gonna go ahead and share my screen, some of our, the main names on their social media. Couple things that you probably didn’t know. If you are listening to the audio of this, then what I can recommend is that you look and find one of the video versions, because I’m gonna share my screen and today, and even though you’re listening you can, can take yes, definitely keep these things in mind. But it may be helpful later on to go back and refer specifically to the video version where you can actually see the screen and, and, and so forth. And if you have any questions, certainly you can get, always get in touch with me and I’ll be happy to help. So I’m gonna share my screen and let’s see. Okay. Okay. You should be able to see my screen. And this is the me do a couple things here, this type issues and so forth, they always are in issues, so let’s make sure we’re okay.

Bill Hartzer (01:41):
Okay. Move stuff outta the way. So this is my blog. Talk a little bit about, let’s say, so this is all one of my latest blog posts about nav Hopkins and so forth while consulting firm. Now I’m gonna take this as an example. So with social media in particular we’re sharing, you know, we may share this, this could be any blog post, any, or any URL, even your homepage of your site. Basically what happens is when you share a post a on social media like let’s say Facebook Facebook or LinkedIn. Okay. Those are two examples. So on Facebook, in particular what Facebook does is they pull a preview. When you, when you go to share a page, like share a post or share an article, what happens is, or share your homepage. Recite what happens is Facebook will, will, if they have never visited that URL before they will actually go to the page real quick and they will get the title, the image, and a description.

Bill Hartzer (02:54):
And they pull that data from from the page, you know, from the page. Now what happens is, is that will, they will cash that. And so what happens is let’s say, for example, I, I posted January 13th, I posted, and I don’t like the fact that that the image that I’m used has navs head cut off a little bit. So I wanna use a different image. And so I go and I update the post. Well, if somebody else shares that same post again on Facebook and ideally, you know, it’s more than one that’s that does a sharing. So when someone shares a Facebook, doesn’t go every single time back to see and look at the post. They, they, they say, okay, well, we already have the image and title on description and the preview. So let’s just pull it from our own, from our own cash, our own database.

Bill Hartzer (03:57):
And, but be yesterday or the day before I went through and I updated the image because it just didn’t look right. Okay. Well, you can actually, you can, before you post or actually even if you’re not gonna share it again, if you wanna update that image, the image that in particular that Facebook has and they’re using, you can actually go, there’s a to the Facebook, the Facebook debugger, and it’s developers at facebook.com/tools/debug. And you can put the URL and you can hit debug, and you can tell Facebook to go ahead and, and scrape that again. And you’re telling to scrape to scrape it again, because there’s an updated version now, 47 minutes ago, I told it to update it. Now, if I wanted to, if I, you know, update the image, I can te click this scrape again, and they will go and they’ll update it, they’ll get the latest title, the latest description, the latest and, and so forth.

Bill Hartzer (05:11):
Okay. So that’s helpful. Especially because if it’s the preview’s not showing up properly now, LinkedIn has what we call the post inspector. And earlier today I was reminded of all this because of the fact that it turns out one a site I’m working with a client I’m working with their site kind of changed their name, a little bit of their, of their, of, or other company name. And so the old version was showing up whenever someone shared their site in LinkedIn, in Facebook or wherever it had the old company name and old, the old logo and the old, you know, image. So basically what I recommended and I was reminded, you know, of the Facebook debugger, but also the LinkedIn post inspector. So basically what you can do is put it in that URL and tell LinkedIn to, you know, you’re telling them to inspect it.

Bill Hartzer (06:24):
You know, you wanna see how that post is gonna look before you post it. Okay. And you can tell them, you know, inspect it. Well, they’re actually doing the same thing as Facebook does if they’re scraping the latest information. Okay. And so, and, and, and they’re going and fetching the URL. Linkedin gives you a little bit more information. They kind, they, they give you a preview of what it’s gonna look like, but then they also tell you, you know, last time they grabbed it, which was a few seconds ago they showed the, the fifths URL and then the KCO URL. And that can actually, in some cases be different. In most cases, it, you know, it, you know, it depends on, on the site and how you set your Canon URL, but in, you know, in most cases, I, I, I, I, all cases on typically will have the same.

Bill Hartzer (07:19):
And then if there’s a redirect, you wanna make sure that if the pay, you know, the, that there’s no redirect. And if you’re using like a short URL, then what, how, and you put that in here, then it’ll show you the redirect and it goes to the right place. But again, if you’re not sure about, and you don’t like preview of how there’s show, it’s showing up when it’s shared or posted in particular what I recommend is going to the sharing debug on Facebook or the post inspector on LinkedIn. Okay. Moving on. So let’s, let’s, I’m gonna close a couple of these and let’s look to me. Let’s look. Another thing is I do a lot of a fair amount of research with domain names and TLD, which is a TD is a top level domain like.com, net.org.

Bill Hartzer (08:16):
In fact, there are right now available through, I can, there are 1,165 TLDs endings.accountants dot AGA do AB Uma, you know, a lot of these company, major companies have bought their own ending. Some are using them. Some are not. So reason why I say this is that there is, you know, you may not be aware, but there’s actually a zone file that can be requested. And so from, and, and there’s a process you go through I can, and you look for the centralized zone data service, you have to sign up for that service, which is free. But you do have to sign it up, sign up for, and then you, for certain, for any of these 1165 TDS, you can request the zone file, which, which is basically the zone file has a list of every single domain name that is registered for that TLD.

Bill Hartzer (09:31):
So if you, for example, if you wanted all a list of all of the, every single domain name that’s registered in.career.careers or.cars, or dot com, for example, okay. You select it and you request access and you have to give a re when you request access, you kind of need to give a reason why you want that data. And usually when I’m doing research and for example, I will, I, I need, you know, I’m working with a registry and I, some of these TLDs, and we wanna do some research on, on Sergeant engine rankings and SEO and, and, and you know, how many domains are actually being used and so forth. And well, it, behold, you know, they registry themselves. They don’t really know that, so what has to happen, you know, they know what domains are registered and that in the zone file, but me, I actually take the zone file, take that data, and then maybe run, you know, and, and, you know, my process, I may, if I’m researching, I may crawl using a crawler and a web crawler, and actually visit every single domain it on that list and then gather certain information from it and you, and, and do whatever I’m gonna be.

Bill Hartzer (11:05):
Do, you know, researching whatever data I need. Usually that’s with the reg, you know, in conjunction with the registry. So what I will do is, in some case is let them know that I’m gonna be requesting access and they will get an email, or they’ll get a, you know, notification that I requested access and why. And then they will grant it. And then I can actually go to my dashboard here in, I can, and actually download, download the file, you know, the file and of, you know, that I need, for example. So that said that’s, you know, that, that information normally is, is, you know, is obviously a list. It changes every day, or it changes when somebody, you know, a domain name expires, then they don’t renew it, it becomes available and so forth. So those zone files are out there.

Bill Hartzer (12:07):
It really only has the limited information as the name of the domain as the name servers, and that is currently pointed to, and it may have an IP address associated with it. So that’s limited, doesn’t really have like the, the, who it is, information who owns it or anything like that. That’s different database and, and, and different discussion probably for a different day of how to get that. Now it came across my desk yesterday or the day before up 2, 3, 2, 2, 3 days ago that there was a domain that was stolen. And that particular domain was so.com. And I want, you know, I’m kind of picking on this because this is in a good example, a very good example. Now, I you know, I, I, I have some confirmation that this particular, just as a footnote, that this domain name is stolen and based on what I have, and I’ll show you how I’ve researched this this is not a client.

Bill Hartzer (13:21):
This is something, you know, a separate situation that I come across. And I got involved because DM protects D N protect.com. It is a service where we recover stolen domain names, and we help the owners get their domain names back. And we also offer a service called domain protection. And so if you have a domain name that you do not, obviously do not want to lose and you know, for whatever reason for expiration, or maybe the renewal came up and you didn’t pay, you didn’t have the money to pay your credit card, didn’t go through whatever, whatever reason somebody filed a U D R P domain dispute on the domain, they filed a, you know, a, a trademark, it was a trademark issue. They filed, you know, they, they sued the domain owner, whatever. If you have domain protection, then all of that is, is covered.

Bill Hartzer (14:24):
And so anyway, so you won’t lose your domain. Now, we also provide DM protect also provides stolen domain name recovery services. If your domain name goes missing, then you will want to contact Ian protect and so forth. Anyway, so this particular domain is an interesting example, and I’ll go through this. So.Com came across my desk and that it was a possible stolen domain. So I wanna research it and find out, you know, it really, you know, what, what the situation is down. I went to the, I can registration the, a look up tool and reason why I’m going to this. And I’m looking it up here is because if I were to take a domain and look it up and look up availability, or look up data that this particular, you know, if I were to look up availability, for example, of a domain, whether it’s taking or, or even a look up at who is who is look up at a registrar, then there is a concern.

Bill Hartzer (15:38):
Not my necessarily my concern. I’m not really concerned about it, but some, some people haven’t have show have expressed concern that the fact, if they do a search at such such registrar, are that their search that they did, especially if the domain was available and they did not re you know, register at the time, they may come back a day later and somebody registered that domain. So that domain, you know, may or may not, you know, be shared now at this time I do searches at the, I can look up because of the fact that typically I know that it’s, I can, and it’s gonna be data that is up to date. And in theory, it’s pulling from that particular database now that is up to date. So basically if we, you know, what I’m looking for with this domain in particular is I’m looking for the name, looking at name, name servers, looking at expiration date and create date.

Bill Hartzer (16:50):
This created this domain with first in October of 94, very old domain name registered until 2024. It is currently held at the name chief registrar. That’s all I really need from there. I do look at this and it looks like it is the, the ownership is being the current owner is be, is is under privacy. That is a particular interesting point. So there’s several things that have come down, you know, come down. So when I went to soo.com typed in the browser at that time, the domain name was listed for sale. There was the landing pages said it was for sale for $50,000. Now just no domains in particular, soo.com is not worth $50,000. I would put it a value of at least a hundred maybe even two or $300,000 because it is soo.com and is a short domain and so forth.

Bill Hartzer (17:54):
I won’t go into evaluation right here, but the $50,000 price tag of it listed is very low. And that is a tip off for me. It’s kind of like going to on Craigslist and looking for a car and you find a 20, 21 Toyota 4runner SUV that normally goes for, even on the used market. It would go for, you know, 50 to $60,000 and it’s listed for sale for three there’s there, there’s a reason why it’s listed so low and being in domain like this. That’s a reg red flag. I mean, just plain and simple is a red flag there now. So let’s go and let’s look at the, who is, so what I can do is go back page.

Bill Hartzer (19:05):
I can go and look at the, his, you know, look up the, who is history using domain IQ. I can look up the, who is, who is owned this domain name and what changes have been made over time. Some of the data might be there. Some, it goes back basically, you know you know, 40, you know, I wanna look at the last, last few changes. So obviously here’s that name? Cheap it’s under privacy. We go back. It changed the, the, the it was listed for sale at Dan Dan D a N is a popular place to list your domain name for sale. Now, previously though it was at registrar servers. Okay. same, you know same who is privacy and, and so forth. Okay. As same as name, cheap back in, you know, first of th you know on January 13th, it had changed again previously I’m going back in time from health Papa to to registrar servers. Okay. Prior in you know, again, it was that name sheet, but it was at host Papa. And, you know, still under privacy, we go back further on the 12th though. However, it was at ho house Papa and network solutions. Okay. And it was at network and was owned by this Macera V R incorporated. I happen to look up the, this address and this address goes to shows on Google street Buick. It shows a, a house, a residential house, and a residential neighborhood owned by Gregory.

Bill Hartzer (21:00):
Okay. And this is the address. So for years and years, as I go back, this ownership has already, you know, has always been open the public. There’s no reason, you know, he to put it under privacy. So all of a sudden the domain goes under privacy goes to name sheep, and then change just name servers, and then it’s put up for sale within within a few days. Yeah. That, that can definitely be typically based on my experience, I don’t see any reason why, if it was at registered and there were solutions for many, many years, and not going to reg you know, no, not gonna expire at 2023. Why all of a sudden just change it to name Jeep. Sure. You could SHA, you know, because of cost, because you’re generally, generally speaking now our solutions annual fees are higher than name sheet. You might say $20 a year. Okay.

Bill Hartzer (22:26):
But we’ll make, make a note of that. Granted in this case though, I, I, haven’t already told that it’s possibly it’s possible that it was a stolen domain. So let me take a look at this Gregory at Macera who see if they own any other domains and see if there are any domains there’s a macera.info and so forth. That is still listed, that is still owned by this. But, you know, it turns out this Mac era, I just have, you know, just done my research a little bit more, and let’s see what happens when we do a search for, you know Macera well, it turns out if we go back a, around the same dates, you know, back in November, December turns out this Macera was at solutions also with the same email address, Gregory mcara.com. And guess what the domain name is impending printing, renew, renewal deletion, and they, it was not renewed and it expired.

Bill Hartzer (23:45):
And the swordfish domains bought the, you know grabbed the domain name when it expired. And it turns out that then they that was at network solutions. But then this Danny Sullivan I happened to know him, but anyway, Danny Sullivan, who was a domain investor had bought that domain and it turns out talk that all, you know, again, you kind of have to question why, when you have data, your information as you’re the owner, why all of a sudden the, who, you know, the who is, is, is even though it’s the same registrar, there’s not really any really good reason, logical reason why all of a sudden it would go under privacy to hide the O the owner. Again, there, there could be good reasons, okay. But this Danny Sullivan knows, and I’m sure he knows that who is ownership in information is out there.

Bill Hartzer (24:55):
We already know that he owns it. So while all of a sudden, you know, there’s not only any reason turns out that he sold the domain name, so does somebody sold it to somebody and and the privacy, and it was changed. A host skater changed the host skater because my suspicions are that he wa whoever the new owner was wanted to recreate Gregory and makara.com who happens to own S a, a much more valuable domain name. So in this case, as we start to put together a you know, look and see what happens. Okay. And yes, again it’s, it’s, it’s still over solutions. In theory, if somebody were to have control over the Mac era.com and set up hosting and set up a, a G you know, set up an email account Gregory, you know, in this case, Gregory macra.com, he would then be able to get into this network solutions account most likely through a password reset cuz he has his email set up and then he gets access to the account and he gets access to all of the domain names that are that are associated, turns out that macra.com viar.com, soo.com and montreal.com sso.com, montreal.com being two domain names that are highly valuable are all associated with this gregory@mcra.com and and so forth.

Bill Hartzer (26:46):
So that paints a picture. I create a good picture of how somebody steals a domain name. I am not going to, you know, I, I don’t have, even though there’s a lot of information here, I, you know, I’m not going to go and say that this the current owner of this.com is stolen, the domain could be something else, could be just some another good re other good reasons. However this is something that that paints a picture and doesn’t look good for the current owner, especially when they go list the domains for sale for a very cheap price that said, so, so the bottom line takeaway of this is that you need to re you to renew your domain names and protect them because if you end up ditching and, and, and not renewing a, a key domain name that is associated with your other domain names somehow, and you won’t lose, you will lose all your domain names.

Bill Hartzer (28:00):
And this is how this is one way of how they are, how they are stolen. Another good example of this is in particular is is a recent case that you can look up that has been in the news. This one has not been in the news but you can go look up the information regarding tilt.com and cus tilt.com, which was owned at one point, tilt.com was owned by Airbnb, the Airbnb on tilt.com. However, the the who is information and the ownership details for the ownership details for tilt dot tilt. The com T I LT was an email address, I believe with custom tilt.com. Well, somebody went and was able to purchase custom tilt.com. They then get access to tilt.com owned by bar Airbnb, but they were able to get access to specifically get access to tilt.com through custom tilt.com and Airbnb then proceeded to lose tilt.com.

Bill Hartzer (29:20):
And I believe there was a U D R P dispute dispute filed where they lost the domain there also. So like I said, when you are looking to secure your websites and valuable properties and the main names the way to protect them is to make sure that you renew your domain names for at least five years or more. That is my recommendation for my most valuable domain names, I registered them for 10 years or more. And the other consideration is the way this was set up. So it, you look at the ma era, M AKA E R a.com domain. The owner is listed as Gregory M AKA E a.com, which is the same domain that is very, you know, highly not recommended because of the fact that if someone gets at access to Macera, then they can, you know, then there’s no way that, or if the owner Gregory loses access to that email address then there’s, you know, and, and, and, or loses access to the domain, they can, they can have all sorts of problems and not have, you know, and, and not be able to access the other domains that might be, might be tied.

Bill Hartzer (30:48):
And so this is a very good example of that, of why you don’t want to use I don’t rec I do not recommend using a free Gmail account, you know as your domain ownership as also because unfortunately gene mail, Hotmail, Yahoo a lot of these free email accounts also get hacked. Once they get hacked to that, E you know, they get access to your email, they get access to all your domain names as well. So I am have a lot of more information about protecting your domain names and so forth, but wanted to go use, go through a very specific I’m not, you know, at this point, I’m not saying that that soo.com is a stolen domain name. However all of the indications that I have based on research and so forth shows that there is something very officially going on with this particular domain name and that that this is how somebody potentially got access to that particular domain that way through an expired domain. So that said, this is the digital marketing with Bill Hartzer podcast for Thursday, January 20th, 2022. I, I will see you next week. First, if you have any questions about SEO, domain names, digital marketing feel free to, to get in touch with me at Hartzer.com. Thanks for listen today. And we’ll talk to you next week. Thanks.

Google Cameos Shutting Down February 17, 2022

Cameos on Google Shutting Down

Add this to the list of Google services that they’ve created and then shut down. Google Cameos (also known as Cameos on Google) is shutting down on February 17, 2022, just less than a month from now. On that date, if you have access to Google Cameos, then you will no longer be able to record and upload videos.

Running cronjobs via an Openswoole timer

Sites I build often utilize cronjobs to periodically pull in data from other sources. For example, I might want to poll an API once a day, or scrape content from another website once a month. Cronjobs are a perfect fit for this.

However, cron has a few problems:

  • If the job is writing information into the file tree of your web application, you need to ensure permissions are correct, both at the filesystem level, and when writing the cronjob (e.g., running it as the same user, or changing permissions on completion).
  • If you are running console tooling associated with your PHP application, you may need to worry about whether or not particular environment variables are in scope when you run the job.
  • In containerized environments, usage of cron is strongly discouraged, as it means running another daemon. You can get around this with tools such as the s6-overlay, but it's another vector for issues.

Since most sites I build anymore use mezzio-swoole, I started wondering if I might be able to handle these jobs another way.

Task workers

We introduced integration with Swoole's task workers in version 2 of mezzio-swoole. Task workers run as a separate pool from web workers, and allow web workers to offload heavy processing when the results are not needed for the current request. They act as a form of per-server message queue, and are great for doing things such as sending emails, processing webhook payloads, and more.

The integration in mezzio-swoole allows you to decorate PSR-14 EventDispatcher listeners in mezzio-swoole Mezzio\Swoole\Task\DeferredListener or DeferredServiceListener instances; when that happens, the decorator creates a task with the Swoole server, giving it the actual listener and the event. When the schedule process the task, it then calls the listener with the event.

The upshot is that to create a task, you just dispatch an event from your code. Your code is thus agnostic about the fact that it's being handled asynchronously.

However, because tasks work in a separate pool, this means that the event instances they receive are technically copies and not references; as such, your application code cannot expect the listener to communicate event state back to you. If you choose to use this feature, only use it for fire-and-forget events.

I bring all this up now because I'm going to circle back to it in a bit.

Scheduling jobs

Swoole's answer to scheduling jobs is its timer. With a timer, you can tick: invoke functionality each time a period has elapsed. Timers operate within event loops, which means every server type that Swoole exposes has a tick() method, including the HTTP server.

The obvious answer, then, is to register a tick:

// Intervals are measured in milliseconds.
// The following means "every 3 hours".
$server->tick(1000 * 60 * 60 * 3, $callback);

Now I hit the problems:

  • How do I get access to the server instance?
  • What can I specify as a callback, and how do I get it?

With mezzio-swoole, the time to register this is when the HTTP server starts. Since Swoole only allows one listener per event, mezzio-swoole composes a PSR-14 event dispatcher, and registers with each Swoole HTTP server event. The listeners then trigger events via the PSR-14 event dispatcher, using custom event types internally that provide access to the data originally passed to the Swoole server events. This approach allows the application developer to attach listeners to events and modify how the application works.

To allow these "workflow" events to be separate from the application if desired, we register a Mezzio\Swoole\Event\EventDispatcherInterface service that returns a discrete PSR-14 event dispatcher implementation. I generally alias this to the PSR-14 interface, so I can use the same instance for application events.

I use my own phly/phly-event-dispatcher implementation, which provides a number of different listener providers. The easiest one is Phly\EventDispatcher\AttachableListenerProvider, which defines a single listen() method for attaching a listener to a given event class.

On top of that, Mezzio and Laminas have a concept of delegator factories. These allow you to "decorate" the creation of a service. One us

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

Weekly News for Designers № 627

Envato Elements

Clay.CSS – Use this library to add 3D claymorphism styles to your design.
Example from Clay.CSS

Wanda – Check out this open-source design system built for digital products and experiences.
Example from Wanda

PHP in 2022 – What the popular language has in store for us this year.
Example from PHP in 2022

Announcing Parcel CSS – Get the details behind this CSS parser, compiler, and minifier.
Example from Announcing Parcel CSS

Mesh·y – This browser-based tool will help you create mesh gradients that can be exported as PNG images.
Example from Meshy

8 Outstanding CSS and JavaScript Chat UI Snippets – Chat UI examples that run the gamut from retro to ultra-modern.
Example from 8 Outstanding CSS and JavaScript Chat UI Snippets

A few lesser-known Figma tips – Helpful hints to increase your efficiency in the design app.
Example from A few lesser-known Figma tips

Simple.css – Use this classless CSS framework to enhance the look of HTML elements.
Example from Simple.css

hue.tools – Explore this open-source toolbox for colors.
Example from hue.tools

The Secret to Successful Food Packaging Design – Take a “field trip” into the design process behind some of the industry’s most successful and effective food packaging designs.
Example from The Secret to Successful Food Packaging Design

Beercss – This framework will help you build Material Design elements.
Example from Beercss

Design Editor – Similar to Canva, this app lets you create images in React, draw diagrams and arrange compositions. From there, you can export to multiple formats.
Example from Design Editor

Omni – A Chrome extension for managing tabs, bookmarks, browser history, and more.
Example from Omni

Are Low-Cost WordPress Projects Worth Your Time? – The answer depends on what exactly you’re looking to gain.
Example from Are Low-Cost WordPress Projects Worth Your Time?

iPhone 14 Mockup – No, the iPhone 14 hasn’t been announced as of this writing. But this free Figma mockup provides a glimpse of what might be.
Example from iPhone 14 Mockup

Perusing the Digital Junk of a Web Designer – Digging through 20+ years of fonts, apps, and dead projects.
Example from Perusing the Digital Junk of a Web Designer

Proge – Test your programming knowledge with this guess-the-language game.
Example from Proge

Brutalita Sans – Give this experimental text editor/brutalist font a try.
Example from Brutalita Sans

The post Weekly News for Designers № 627 appeared first on Speckyboy Design Magazine.

PHP Wallet API and Application

Package:
PHP Wallet API and Application
Summary:
Application to manage a wallet by calling an API
Groups:
Finances, PHP 5, Web services
Author:
mohammad anzawi
Description:
This package provides an application to manage a wallet by calling an API...

Read more at https://www.phpclasses.org/package/12360-PHP-Application-to-manage-a-wallet-by-calling-an-API.html#2022-01-20-21:48:04
Powered by Gewgley