10 Best Prebuilt Websites for Digital Agencies & Consultants

Original Source: https://www.sitepoint.com/prebuilt-websites-agencies-consultants/?utm_source=rss

BeTheme has 10 of the best prebuilt websites for digital agencies and consultants. If you’re building a new site or redesigning an existing one, start your search here.

Continue reading
10 Best Prebuilt Websites for Digital Agencies & Consultants
on SitePoint.

15 Podcast Channels for Web Developers

Original Source: https://www.hongkiat.com/blog/podcasts-web-developers/

Listening to podcasts is a great way to stay up-to-date in the web development field. Podcasts provide a convenient way for you to learn and get information since you don’t need to sit down at your desk for that.

Here, we’ve put together some of the best podcasts for developers, covering various topics such as software development, frontend development, JavaScript, CSS, and more. Whether you’re a seasoned developer or just starting out, I’m pretty sure you will find a podcast that fits your needs. So grab your headphones and get ready to learn!

1. ShopTalk Show
ShopTalk ShowShopTalk Show

One of the most popular web design podcasts, hosted by Chris Coyier of CSS-Tricks and Dave of Paravel, ShopTalk invites experts in the field of web design and programming to share their ideas and experiences.

They currently have more than 100 episodes already and counting, and podcast releases are weekly.

2. Boagworld
BoagworldBoagworld

Paul Boag is a well-respected name in the web design industry. He is an author who has released several bestselling books and is a founder of the UK-based design agency, Headscape.

His podcast, Boagworld, has been on air since 2011 with more than 100 episodes on website building and digital strategy, making it one of the longest-running podcast channels in the industry. You can subscribe to Boagworld through RSS or through iTunes.

3. Inside Marketing Design
Inside Marketing DesignInside Marketing Design

Inside Marketing Design is a podcast that can help you learn more about a different side of design in tech. The show is focused on marketing and brand design, which is not as much mentioned or discussed as product and UI/UX design.

Each episode features an interview with marketing design experts from large tech companies such as Stripe, Zendesk, Zapier, Shopify, etc. You’ll hear about how they design things like landing pages, brand illustrations, and campaigns.

By listening to these interviews, you’ll get a better understanding of how design teams work, how they tackle projects, and what challenges they face.

4. Beyond Coding
Beyond CodingBeyond Coding

Beyond Coding is a weekly podcast that covers a variety of topics related to software development and software engineering. But as the name implies, it goes beyond just coding.

It also includes discussions on leadership, communication, self-improvement, and happiness. The show is hosted in a friendly and informal format, with host Patrick Akil and his guests having relaxed conversations about their experiences and perspectives. There’s a new episodes every Wednesday.

5. Syntax FM
Syntax FMSyntax FM

A podcast hosted by two experienced web developers, Scott Tolinski and Wes Bos, and they cover a wide range of topics related to frontend development, back-end development, and design.

They’ll provide you with practical advice, tips, and insights to help you improve your skills and stay up-to-date with the latest trends and best practices in the industry. It’s one of the most popular podcasts in the web community for its in-depth conversations and insightful commentary.

6. CodePen Radio
CodePen RadioCodePen Radio

A podcast from codepen.io, a popular online code editor for frontend developers and designers. The podcast focuses on web development, design, and the intersection of code and creativity.

The show is hosted by Chris Coyier and Marie Mosley, and they explore a variety of topics related to the web, including design patterns, CSS, JavaScript, and more. It is a great resource for front-end developers and designers looking to stay up-to-date with the latest trends and best practices in their field.

7. CodeNewbie Podcast
odeNewbie PodcastodeNewbie Podcast

A podcast for people who are new to coding or who are thinking about starting a career in technology. The show is hosted by Saron Yitbarek and features conversations with developers and tech professionals from a variety of backgrounds.

It covers a wide range of topics from coding and the technology as well as how to get started with programming, tips for staying motivated, and stories about the ups and downs of learning to code.

The podcast is part of the CodeNewbie community, which is dedicated to helping people learn to code and find their place in the tech industry.

8. Frontend Happy Hour
Frontend Happy HourFrontend Happy Hour

Hosted by a group of experienced web developers from well-respected names in the tech industry such as Netflix, Twitch, Atlassian, Evernote, and LinkedIn. It features discussions on various topics related to frontend development, including the latest trends, best practices, and latest shiny tools.

It’s great podcast for frontend developers who want to stay up-to-date with the latest trends and best practices in their field, as well as for those who are looking for inspiration and advice on how to grow and succeed as a frontend developer.

9. Web Rush
Web RushWeb Rush

A weekly podcast for web developers hosted by John Papa, Ward Bell, Craig Shoemaker, and Dan Wahlin. It covers various topics from JavaScript to general web development. The show aims to provide practical insights and discussions about the challenges faced by developers today.

Each episode features expert guests who share their experience and knowledge. It is a great resource for learning with development in the fields, whether you’re a beginner or an experienced web developer.

10. JavaScript Jabber
JavaScript JabberJavaScript Jabber

Another weekly podcast covering a wide range of topics related to JavaScript, web development, and the web platform. It aims to provide insights, tips, and advice to help developers improve their skills and stay up-to-date.

A great resource for anyone interested in web development, especially those working with JavaScript, and is accessible to developers of all levels, from beginners to experts.

11. Views on Vue
Views on VueViews on Vue

A podcast about Vue.js, featuring conversations with developers and experts who are working with Vue.js. Each episode covers various topics around Vue.js, such as the best practices, emerging trends, and some real-world projects using Vue.js.

A perfect podcast for any developer looking to learn more about Vue.js or who is already using it in their work.

12. DeveloperTea
DeveloperTeaDeveloperTea

A podcast for web and software developers hosted by Jonathan Cutrell. This podcast is designed to be a quick and easy way for developers to stay informed about the latest in the development field.

Each episode is around 10-15 minutes long and covers various of topics, from technical skills and tools as well as non-technical areas for developers. A great podcast for developers at all levels or for anyone interested in web and software development.

13. Podrocket
PodrocketPodrocket

A weekly podcast that focuses on front-end web development. It is hosted by LogRocket co-founder Ben Edelstein and the LogRocket engineering team, along with other experienced developers.

The show provides in-depth knowledge and insights on libraries, frameworks, and current industry issues related in web development.

14. The Changelog
The ChangelogThe Changelog

A weekly podcast that covers topics related to open-source, software development, and technology in general. Hosted by Adam Stacoviak and Jerod Santo. The show features interviews with developers, engineers, and other experts in the software development industry.

The podcast covers a wide range of topics, including new and emerging technologies, tips, and the future of open-source software. If you’re into open-source, it’s a great resource for anyone interested in staying up-to-date with the latest developments in the open-source field.

15. The CSS Podcast
The CSS PodcastThe CSS Podcast

A podcast covering about all things CSS. It is hosted by Una Kravets and Adam Argyle, discussing a wide range of topics related to CSS, including the latest CSS features, design and development tips and tricks, and more.

They also interview experts in the field to provide insights and perspectives on the current state of CSS and its future direction. If you are interested in learning more about CSS and keeping up-to-date with the latest advancements in this field, stay tune to this podcast.

The post 15 Podcast Channels for Web Developers appeared first on Hongkiat.

The best Photoshop alternatives in 2023

Original Source: https://www.creativebloq.com/photoshop/alternatives-1131641

From Affinity to Procreate: The best Photoshop alternatives for Mac, Windows and more.

A Step-By-Step Guide To Building Accessible Carousels

Original Source: https://smashingmagazine.com/2023/02/guide-building-accessible-carousels/

You can spot them on every other homepage: carousel widgets with auto-rotating content. Those who use them want to show more content within a limited space. At the same time, they aim to present the most important messages as prominently as possible. However, if design and development do not receive proper attention, you will be at the highest risk of creating usability and accessibility issues.

This particularly affects people with cognitive, motor, or visual impairments, for whom using the complex design pattern is usually even more challenging. Whether you call it an “eye candy” or “devil’s spawn”, if you want to implement the carousel in a user-friendly and accessible way, a whole range of requirements is to be considered.

“Should I Use A Carousel?”

As widely used as they are, carousel widgets have a bad reputation among UX professionals. They are ignored by users (Nielsen Norman Group), only 1% interact with a carousel at all, and 89% of them only with the first slide (Eric Runyon). Jared Smith even responds to the question “Should I use A Carousel?” by saying, “Seriously, you really shouldn’t.” Others state that there isn’t one answer. You have to consider various factors, such as function, design, platform (desktop or mobile) and, most importantly, context. For whatever reason you include a carousel on a website, make sure it is user-friendly and accessible.

Accessible Implementation

For a carousel to be accessible, it is essential that all users can perceive the widget and its components and that they can easily navigate it using a mouse, touch gestures, a keyboard, a screen reader, and any other assistive technology. The rotation of the slides must not interfere with users’ ability to operate the carousel or use the website as a whole.

The W3C’s WAI-ARIA working group provides guidance on implementing an accessible carousel in its ARIA Authoring Practices Guide (APG). This article is based on those recommendations and wants to create a profound understanding of elements and ARIA attributes applied and their impact on users.

Auto-Rotating

I assume we have all been there at some point: Constantly changing content can be rather annoying. For some people, however, uncontrolled rotation can be absolutely critical:

People need different times to read content.
If the available time is not enough, auto-advancing carousels can become very frustrating. It’s not very satisfying to just be able to skim the text before new content appears without any request.
Some people, especially people with cognitive impairments such as attention deficit disorder, may experience moving content distracting.
The movement could prevent users from concentrating and interacting with the rest of the website. People within the autistic spectrum may even have to leave such a page entirely.
Screen reader users may not be aware of the rotation.
They might read a heading on “slide 1” and execute the keyboard command for “read next item.” Instead of hearing the next element on “slide 1”, the screen reader announces a text from “slide 2” — without the person knowing that the element just read out is from an entirely new context.

WCAG 2.1, therefore, requires the possibility to stop movement (2.2.2 Pause, Stop, Hide).

Add a “Pause” or “Stop” button if you cannot give up auto-rotation at all.
The “Pause” button is the minimum solution (if the movement does not end automatically after 5 seconds).
In addition, usability experts recommend the following:
Pause auto-rotation as long as a slide is being hovered.
There is usually a correlation between the mouse position and the user’s interest in a piece of content. Don’t risk a slide change a few milliseconds before a person activates a link and then ends up on the wrong page and, to make things worse, not realizing that this was not the intended one.
Stop the rotation permanently when users are setting focus on interactive elements using a keyboard or interacting with the carousel.
An action such as actively changing slides also indicates that the user might be interested in the content. People may temporarily explore other parts of the page but possibly want to come back. Furthermore, you make keyboard navigation easier if the carousel stops as soon as a control receives focus.

Visibility

For all of us, user interface elements are intuitively easier to use if we can perceive them well. For people with visual impairments, however, this aspect is crucial.

Ensure sufficient contrast.
Most often, icons are used to indicate the controls: simple arrows for advancing the slides as well as the widely used dots for selectively fading in. However, these icons often have poor contrast against the background, especially when placed on images. The easiest way to avoid contrast issues is to position the icons outside the slides.
Provide a visible focus indicator.
People navigating with a keyboard need to be able to see which interactive element they are currently focusing on. Often design merely (if at all) provides a slight and barely discernible change in color of the controls. If color is the only way to indicate focus, both colors (the one used for non-focused and focused state) must meet at least a contrast ratio of 3.0:1 with each other. This minimum contrast requirement also applies to the icon against its background and to other kinds of focus indicators (e.g., a border that indicates the focus state of a button).
The size of the controls affects their visibility as well.
Besides, with a reasonable target size combined with sufficient distance between interactive elements, you reduce the risk of accidentally activating a nearby button or a linked slide. This not only benefits people with limited dexterity but also minimizes errors when using mobile devices.
Indicate the current position within the set of slides.
It is not the only option, but often this is done by highlighting one of several progress dots. To ensure that people with color deficiencies can access visual information, you must not rely on color alone but use a color-independent indicator, for example, a filled and unfilled dot.

Activation With A Simple Pointer Input

Many people are used to moving slides on touch devices by swiping. But there are also users who cannot perform this gesture because of their impairment or because of the assistive technology they use. In addition to swiping, enable users with an alternative way of navigating (WCAG 2.5.1 Pointer Gestures).

Provide interaction with a simple pointer input (e.g., simple click or tap). That means if there are no slide picker controls to display content directly, you need to implement “Previous” and “Next” buttons.

Structure, Semantics And Labelling

The carousel widget is designed primarily for two-dimensional, visual use. For screen reader users who do not see the carousel as a whole, it is much harder to understand the composition of controls and content. These users have different perspectives when using a website. They explore content linearly, tab through interactive elements, and use shortcuts for navigation. The challenge is to provide a meaningful structure and semantics and inform users about controls and slides in a way that enables them to build a mental model of the widget. Use semantic markup for different sections, controls, and content and proper labeling to ensure good orientation.

Regions And Groups

Using the HTML element <section> (or role=”region”) with an accessible name, you can set a generic landmark and thus mark smaller regions of a page. Landmarks provide a way to identify the structure of a web page to screen reader users and help them with orientation. Using a screen reader, you can display these sections in a table of contents and use specific keyboard shortcuts for landmarks to move focus to the corresponding content.

When navigating to the landmark, the assistive technology announces the name and type of the section, for example: “[name] — region”. In browse mode (exploring content with arrow keys), the screen reader tells users when they enter or exit a region. They will hear something like “[name] — region” or “out of region”. (This output in browse mode is currently well-supported by the screen reader NVDA, but unfortunately, with JAWS, users have to set screen reader settings accordingly.)

role=”group” is intended to form a logical set of items as a group. Since it is not a landmark, the group is not included in a landmark listing displayed by the user. For that reason, use this role in contrast to role=”region” for less important sections of a page. You could use role=”group”, for example, to group (custom) form controls (compare <fieldset> and <legend> in HTML) but it is not limited to this.

With role=”group”, it is also necessary to use the role with an accessible name. The screen reader will convey the boundaries of the group by announcing something like “[name] — grouping” or “out of grouping,” and the assistive technology will inform users about the start and end of the group (in this case also JAWS in the default setting).

The following applies to role=”region” and role=”group”: When the first interactive element within the region or group receives focus, the screen reader will announce its name and role, plus the role and label of the focused control.

The Carousel Container

Currently, there is no specific HTML element or ARIA role to mark up a carousel. However, you can still convey semantic information to make the existence of the carousel, its sections, and the meaning of the controls clear and understandable to non-visual users. That will help them better adapt to the widget and its interaction patterns.

role=”region|group” + accessible name

An easy way to make non-visual users aware of the carousel is to use a landmark or a group role: To get there, use the <section> element (or role=”region”) or role=”group” for the container that encompasses all the carousel elements (including the carousel controls and slides). In addition, provide an accessible name that identifies the carousel as such.

Carousel container marked with a landmark:

<div role=”region” aria-label=”Carousel”>
<!– Slides and controls –>
</div>

Screen reader output when encountering the widget: „Carousel — region“

The W3C Authoring Practices go beyond this basic markup and recommend using the aria-roledescription attribute:

role=”region|group” + aria-roledescription + accessible name

With aria-roledescription, you create an even more specific output for screen reader users. You thus define the meaning of the container more precisely.

Code sample (HTML): Carousel container marked with a landmark with a specified meaning

<div role=”region” aria-roledescription=”carousel” aria-label=”Design patterns”>
<!– Slides and controls –>
</div>

Screen reader output: “Design patterns — carousel” instead of (without using aria-roledescription) “Design patterns — region.” In the previous example, we have seen a more generic accessible name (“Carousel”). With role=”region”, this has resulted in the output: “Carousel — region”.

aria-roledescription changes the way a screen reader announces the role of an element. This allows authors to define a localized and human-readable description for a role. The screen reader announces the value of aria-roledescription (a string provided by the author) instead of the original role. It overrides the role to which the attribute is applied. aria-roledescription should only be used on elements that have a valid implicit or explicit (ARIA) role.

Back to our carousel, this means instead of region or grouping (you can also use role=”group” instead of role=”region”), the value of aria-roledescription is read out by the assistive technology. Note: If the aria-roledescription property is set to “carousel”, you should not set the aria-label property to “carousel” because this would be redundant.

The ARIA specification recommends the attribute mainly for clarifying the purpose of non-interactive container roles such as group or region. Otherwise, use it with great caution:

“Do not use aria-roledescription to change the way a role is announced, if it will prevent the user from knowing what to do with it.”

— Léonie Watson

The Slide Container

Just as you communicate the boundaries of the carousel as a whole, you can do the same for the slides. Each slide represents simply a smaller entity within the “carousel” composite.

role=”group” + aria-roledescription + accessible name

Container for slides marked as “group” with a specified meaning:

<div role=”group” aria-roledescription=”slide” aria-labelledby=”carousel_item-1_heading”>
<h2 id=”carousel_item-1_heading”>Modal dialogs</h2>
<!– Some more content –>
</div>

Screen reader output: „Slide — heading level 2 — Modal dialogs“

In this example, the heading of the slide serves as the accessible name of the group. The aria-labelledby property is set to the id of the heading. You could also use the aria-label attribute to convey the position within the set of slides, for example, “1 of 3”. In particular, that makes sense if no unique name is available to identify the slide.

Again, if you set aria-roledescription to “slide”, the aria-label property should not be set to “slide” to avoid redundancy.

The Slides

Slides that are not visible should be hidden, not only visually but from all users (including users of assistive technology). You can either use CSS (display: none or visibility: hidden) or the HTML hidden attribute.

If you truly hide the slides that are not visible, you should not use list markup for the whole set of slides. Screen readers do announce the number of list items (which may seem helpful) but will ignore hidden ones. Concerning the carousel, list markup would not result in an output of the total number of list items but just the visible ones. If only one slide is visible, that wouldn’t be very helpful.

The Container For The Controls

What about the container for the controls? It also encompasses a set of items. Because of this, it is reasonable to apply role=”group” to it. And again, the group needs an appropriate group name.

role=”group” + accessible name

Container for controls marked as “group” with a specified meaning:

<div role=”group” aria-label=”Slide controls”>
<!– Slide controls –>
</div>

Screen reader output: „Slide controls — grouping“

In this context, the accessible name (the group name) reflects the purpose of the controls, for example, “Slide controls” or “Choose a slide”.

The ARIA Authoring Practices refer to this implementation as a “grouped carousel”. Another approach is described as “tabbed carousel”. Following the “tabbed” pattern, you would use role=”tablist”, role=”tab” for the controls and role=”tabpanel” (instead of role=”group”) for the slide container. Don’t use aria-roledescription in this case. The appropriate ARIA properties are specified in the tab pattern.

The Controls

Slide picker controls allow users to display a specific slide. They visually present the total number of slides and indicate the current position within the set. It is rather popular to use “dots” for that purpose.

Operable Keyboard Controls

All controls must be operable with the keyboard. Use the native button element for controls of the grouped carousel. That involves the “Previous” and “Next” buttons, the “Pause” button, and the slide picker controls.

If you cannot use native HTML, add semantic information by applying an explicit ARIA role (role=”button”) to the clickable div or span element. Use tabindex=”0″ to include the element in the tab sequence. Furthermore, you need to incorporate JavaScript that provides interactions expected for a button (activation with Space and Enter ). Be aware that ARIA roles do not cause browsers to provide keyboard behaviors.

Grouped controls

<div role=”group” aria-label=”Slide controls”>
<button aria-label=”Show slide 1 of 4″>
<!– SVG icon –>
</button>
<!– Some more controls –>
</div>

Screen reader output: „Slide controls — grouping — Show slide 1 of 4 — button“

The Accessible Name Of The Controls

Choose an appropriate accessible name (text alternative) in context with the group name. Regarding the above example, the screen reader would announce: “Slide controls — grouping — Show slide 1 of 4″ — button” when focusing on the first control in the group (or “Slide controls — grouping — Pause — button” if the first control is a “Pause” button).

Assuming the group name is “Choose a slide,” then the heading of the corresponding slide would also be a reasonable label for the button in this context. Instead of using the aria-label attribute, you could also specify the label using visually hidden text.

Along with the group name and the slide picker elements, the “Previous,” “Next,” and “Pause” buttons need an accessible name. That means do not forget about the text alternatives for these icons either.

Semantic Markup Of The Active Control

Do not just indicate visually but also semantically which control does represent the currently displayed slide. You can use aria-disabled=”true” for this purpose. In this case, aria-disabled is preferable to the HTML attribute disabled. Unlike disabled, a button with an aria-disabled attribute is still included in the tab sequence of the page. You may also use the aria-current property set to “true”.

Focus Order

For a webpage to be accessible using a keyboard or assistive technology, it is important to ensure a proper focus order. That is the order in which you tab through interactive elements. An appropriate order generally means that it follows the visual flow of the page. Users can navigate in a logical and predictable way without loss of orientation.

By default, the tab order is set by order of the elements in the source code (more precisely, in the DOM). That means that the order in which you write the HTML will affect the focus order when navigating with the keyboard. The DOM order also affects the reading order, that is, the order in which screen reader users in browse mode linearly explore content using the arrow keys (non-interactive content included).

The DOM and, with it, the focus sequence should match as closely as possible to the visual order of the page. In this way, sighted keyboard users can easily follow the sequence.

Content changes that precede the current focus cause issues with sequential navigation since screen reader users will not know about such changes (apart from dynamically displayed status messages implemented using live regions). Users need to navigate backwards to reach those interactive elements, which makes navigation more difficult.

A Proper And Understandable Focus Order For A Carousel

Many carousel implementations are intended to visually display the controls below the slides:

Previous
Slide
Next
Pause
Slide Controls

If this order matches the order of the elements in the DOM, both the activation of “Next” and the activation of the slide controls will cause a content change (display of a new slide) before the triggering control. That is, users need to navigate backwards if they want to explore the content of the slide with the screen reader or follow a link on the slide.

DOM Order

The focus order is easier to use, and the reading order is more meaningful if the controls (at least the “Pause” button and the slide controls) are positioned in the DOM before the changing slides. If you still want the controls to be visually positioned below the carousel, use CSS for this purpose. When in doubt, a good focus and reading order for the carousel is more important than the optimal conformity with the visual order:

Pause
Slide controls
Previous
Slide
Next

or

Pause
Slide controls
Previous
Next
Slide

Notice that people working with magnification software will locate the “Pause” button more quickly if it is also visually positioned at the beginning of the carousel. They do not see the carousel as one (depending on the magnification level) but might explore the content by moving the keyboard focus or the mouse pointer, which results in repositioning their viewport.

Pause And Previous/Next Buttons

When activating the Pause / Play and Previous / Next control, the focus has to remain on the button. That allows sighted keyboard users to repeatedly press the button and perceive the changing content at the same time.

The Keyboard Navigation For “Tabbed Carousels”

If you prefer following the “tabbed carousel” pattern, allow users to navigate with arrow keys within the set of controls. In addition, ARIA markup must correspond to the tab pattern (unlike the “grouped carousel”) to make screen reader users understand the expected operation based on the information announced by the screen reader.

Working Example

Complete carousel widget:

<div role=”region” aria-roledescription=”carousel” aria-label=”Tips & Techniques”>
<div role=”group” aria-label=”Slide controls”>
<button aria-label=”Stop auto-rotation”>
<!– SVG icon –>
</button>
<button aria-disabled=”true”>
<span class=”hide-element”>Show slide 1 of 3: Hiding Accessibly</span>
<!– SVG icon –>
</button>
<button aria-disabled=”false”>
<span class=”hide-element”>Show slide 2 von 3: Accessible Contrasts</span>
<!– SVG icon –>
</button>
<button aria-disabled=”false”>
<span class=”hide-element”>Show slide 3 von 3: Semantics, WAI-ARIA and Assistive Technologies</span>
<!– SVG icon –>
</button>
<button aria-label=”Previous slide”>
<!– SVG icon –>
</button>
<button aria-label=”Next slide”>
<!– SVG icon –>
</button>
</div>
<div role=”group” aria-roledescription=”Slide” aria-labelledby=”carousel-item-1__heading” id=”carousel-item-1″>
<h2 id=”carousel-item-1__heading”>Hiding accessibly</h2>
<!– Further slide contents –>
</div>
<div hidden role=”group” aria-roledescription=”Slide” aria-labelledby=”carousel-item-2__heading” id=”carousel-item-2″>
<h2 id=”carousel-item-2__heading”>Accessible Contrasts</h2>
<!– Further slide contents –>
</div>
<div hidden role=”group” aria-roledescription=”Slide” aria-labelledby=”carousel-item-3__heading” id=”carousel-item-3″>
<h2 id=”carousel-item-3__heading”>Semantics, WAI-ARIA and Assistive Technologies</h2>
<!– Further slide contents –>
</div>
</div>

Wrapping Up

Add a button to pause or stop all movement.
Ensure that controls have sufficient contrast (meet WCAG’s color contrast requirements).
Provide a visible focus indicator.
Don’t rely solely on swiping. In addition, provide interaction with a simple pointer input (e.g., simple click or tap).
Provide semantic markup and labeling to ensure that screen readers can identify the carousel as a whole, the slides, and the set of controls. For the “grouped carousel”, use role=”group” with an aria-label or aria-labelledby attribute. For the carousel container, you can also use a landmark (role=”region” with an accessible name) instead of role=”group”.
The aria-roledescription attribute allows you to specify the meaning of the container tagged with role=”region” or role=”group”.
If you go for the “tabbed carousel”, use the ARIA attributes specified in the tab pattern. Ensure keyboard navigation within the set of “tabs” can be operated with the arrow keys.
All controls must be keyboard operable and require meaningful text alternatives for icons.
Ensure a proper focus order. It is recommended to position at least “Pause” and slide controls in the DOM before the slides, even if this order may differ slightly from the visual tab order.

Conclusion

This article describes one way of implementing carousel widgets in an accessible way. Even W3C working groups provide different approaches in the ARIA Authoring Practices Guide (APG) and the W3C Accessibility Tutorial (see also a discussion on GitHub and the comment by Jason Web regarding user testing of “tabbed carousels” and focus management). The important thing is:

Be familiar with semantic markup options and their impact on users.
The objective is to provide a predictable and understandable way of operating the widget, also for non-visual users.
Test with a keyboard and a screen reader. This will show most clearly whether you have met your goal or not.
If you do not have the resources to implement a carousel in an accessible way or if it is just the wrong pattern, better explore alternatives, and you might notice the benefits they entail.

“Carousels are complex components, and making complex components accessible adds more complexity.”

— Léonie Watson

Note: This article was first published in German on tollwerk.de in April 2022.

Useful Resources

“ARIA Authoring Practices Guide (APG), Carousel,” W3C Web Accessibility Initiative
“How To Build A More Accessible Carousel Or Slider,” Jason Web
“The Unbearable Inaccessibility Of Slideshows,” Gian Wild
“W3C Accessibility Tutorial,” W3C Web Accessibility Initiative (WAI)
“Using The aria-roledescription Attribute,” Léonie Watson
“Designing A Better Carousel UX,” Vitaly Friedman
“Carousel/Slider Design Best Practices (with examples),” Vitaly Friedman (Video)
“5 Alternatives To Using A Carousel On Your Website Homepage,” Mightybytes
“More Alternatives To Using A Carousel On Your Website,” Mightybytes

20 Best New Websites, February 2023

Original Source: https://www.webdesignerdepot.com/2023/02/20-best-new-websites-february-2023/

The quality of websites in 2023 has moved up a gear, with designers cherry-picking trends as tools, embracing new ideas, and plenty of innovative UI details.

Every month we put together this roundup of the best new websites we’ve seen over the previous four weeks. In February’s edition, you’ll find warm colors to brighten grey days and lots of animation. Enjoy!

CTRL SHIFT!

CTRL SHIFT! is a podcast about people who changed the world by changing their perspectives. Its site features an excellent scrolling set of animations.

Earthfoam

Earthfoam is a new kind of mattress and pillow. It uses soft colors and subtle animation to create a sense of calm and well-being. There’s fantastic attention to detail on this site.

July 01

The microsite for July 01, a new typeface from Studio K95, is brilliantly engaging with retro art direction and some well-chosen gradients. This is how fonts should be sold.

The Checkout 2022

The Checkout 2022 is a look back at last year through the lens of purchases made via Klarna. The microsite features pixel-style animation and typography that is very 2023.

Water

Water is a collection of kitchen products by Falmec. The site is like a high-end brochure, with intelligent content design and an overarching aesthetic.

Summer Afternoon

Summer Afternoon is a beautiful Studio Ghibli-esque 3D experiment. Explore the environment and discover five different secrets. It’s delightful.

Maciej Zadykowicz

Maciej Zadykowicz’s portfolio is suitably dark mode for someone who specializes in Ethereum and web3, but it’s brought to life by the splashes of animated color.

Dot Pad

Dot Pad is an innovative tactile display for visual data. It allows you to feel the world you see. Its site has many clever details; we particularly like what happens with the menu when you scroll.

Cal.com

Cal.com is an event scheduler app. Its site features black-and-white typography that is elevated by subtle shadows and a clear hierarchy. Simple ordered, and appropriate.

Pure Sunfarms

Pure Sunfarms sells cannabis, and its retro vibes take us all back to long Summer days when the world seemed more innocent and chilled.

Madre Mezcal

The warm terracotta color of Madre Mezcal transports you to warmer climes. The illustrations and typography are on-brand, but what we really love is the variable scrolling on the content columns.

Fey

Fey is an app for investors, and its simple site is suitably restrained and high-quality. Some nice animations do a great job of highlighting the app’s features.

Carl Beaverson

Carl Beaverson’s portfolio is an exercise in restraint. It‘s just a series of tastefully presented thumbnails. Obvious accessibility issues aside, the pale text looks beautiful against the soft grey backgrounds.

Bakstad Construction

2022’s Brutalism trend has waned, and we’re seeing a lot less of the style. But in the case of Bakstad Construction, nothing could be more appropriate.

Nightworks

Nightworks creates stunning lighting products that would grace any home. Its site oozes luxury from every pixel. The type, colors, and layout all convey quality.

Village

We’re used to team scheduling apps, but Village is a team scheduling app for your family. The desaturated colors and modern look is perfectly pitched at young families.

Hotel 23

Hotel 23 is amazing-looking in Medellín, Columbia. Its site features shapes and colors that reflect the building’s decor, and the room slideshow is charming and original.

Flat Camp

Flat Camp is a retreat for up to 50 members of the Statamic community. Its site is clean and clear without being dull and minimal. And the hilltop illustration is highly appealing.

Aviv Katz

We love the playfulness of Aviv Katz’s portfolio. There’s lots to explore in the UI and some great work on display.

Samara

When you’re selling six-figure products, you better have a great site. Samara sells small houses that fit in a backyard, with everything you need included. It’s ideal for a home office or an Airbnb.

Source

p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}

The post 20 Best New Websites, February 2023 first appeared on Webdesigner Depot.

Pagecloud vs Squarespace: Which is Right for You?

Original Source: https://ecommerce-platforms.com/articles/pagecloud-vs-squarespace

Pagecloud vs Squarespace: which tool should you be using to build your business website?

Both Pagecloud and Squarespace have a lot of benefits to offer potential entrepreneurs and store owners looking to claim their part of the online market. Each platform offers a simple and straightforward set of tools for creating, customizing, and optimizing your online presence.

With Squarespace, you can design a stunning site in a matter of minutes, using some of the world’s most highly regarded themes and templates. There are templates for building everything from compelling online portfolios to SEO-optimized blogs and ecommerce stores.

With Pagecloud, you can leverage an equally intuitive no-code website builder to launch, market, and grow your online business. There’s support for blogging, ecommerce sales, subscriptions, and service-based websites. Plus, you can even edit the source code for your site directly if you choose.

So, which solution is best?

Pagecloud vs Squarespace: Pros and Cons

All website builders have their own pros and cons. Some excel at helping content creators to stand out online, with SEO, marketing integrations, and promotional tools, but lack advanced ecommerce tools. Others are fantastic for making entrepreneurs looking to monetize their online presence, but may lack customization options, or scalability.

Both Pagecloud and Squarespace are fundamentally targeted at smaller companies, looking for a budget-friendly way to design a website with minimal coding or tech knowledge. They both allow users to build websites using intuitive templates and themes, and can both enable brands to take payments for services, products, and digital assets.

Squarespace is often the go-to solution for content creators and experts looking to build engaging, and professional-looking portfolios online. It has marketing tools and SEO functionality built-in, as well as dedicated templates for a range of industries.

Pagecloud is ideal for building one-page websites and online stores. It makes it easy to showcase social media links and bios, and helps entrepreneurs to grow their sales with inventory tracking and customizable storefronts.

Squarespace Pros and Cons

Pros 👍
Cons 👎

Pros 👍

Award-winning templates and themes
Built-in SEO and marketing capabilities
Online selling for products, downloads, and services
Included scheduling and booking tools
Options for building membership sites
Email marketing and social media integrations
Easy-to-use no-code builder
Website analytics and reporting
Creator tools (Video maker, logo maker, etc)

Cons 👎

Some limitations on inventory tracking
Limited scalability for bigger businesses
Fewer customization options than some alternatives

Pagecloud Pros and Cons

Pros 👍
Cons 👎

Pros 👍

Various beautiful templates
Source code access for customization
Transparent pricing structure
Easy-to-use drag-and-drop builder
Support for selling products, services, and digital items
Portfolio tools with social media integrations
Team member support for collaborative building
Marketing and SEO features
Forms for collecting lead data

Cons 👎

Limited scalability for larger sites
Add-ons required for analytics and reporting
Small selection of templates

Go to the top

illustration of a cat climbing a ladder

Squarespace vs Pagecloud: Background Info

There’s a lot of overlap between the features offered by Pagecloud and Squarespace. Both tools are ideal for building single-page professional portfolios, blogging sites, and ecommerce stores. They also both come with excellent SEO features, powerful monetization options, and the ability to integrate your site with multiple marketing tools.

Squarespace is a little better-known than Pagecloud, however. The solution first emerged online in 2004, with one of the first intuitive drag-and-drop builders around. Since then, Squarespace has become one of the go-to tools for website building, thanks in large part to its award-winning templates, user-friendliness, and constant commitment to innovation.

squarespace homepage

Squarespace now offers not just a comprehensive website builder, but also ecommerce tools for selling products, services, memberships, and digital assets. You can also access SEO tools, video makers, logo makers, and scheduling systems from Squarespace.

Pagecloud is a much newer addition to the low-code website building landscape, launching officially in 2015. This company supports business leaders in more than 130 countries, giving them all the tools, they need to create immersive portfolios, compelling ecommerce sites, and blogs.

pagecloud homepage

Pagecloud integrates with a range of existing apps and services, so you can align your website with your strategies for email and social media marketing. Companies can also request specialist services and support from Pagecloud developers, to help them build or manage their sites.

Go to the top

illustration of a cat climbing a ladder

Squarespace vs Pagecloud: Basic Features

With both Squarespace and Pagecloud, entrepreneurs can design one-page portfolios, blogs, ecommerce websites, membership sites, and more. Both tools promise stunning templates which look fantastic on any screen. They each also give business leaders a range of options for customizing their store, connecting with new customers, and boosting brand awareness.

Here are some of the features you’ll find included with both tools

Portfolio design: Both Squarespace and Pagecloud are great for building one-page websites and portfolios. There are dedicated templates available to help you showcase your work, as well as integrations with social media buttons so you can expand your reach online.

Ecommerce: Squarespace and Pagecloud both enable ecommerce selling. Pagecloud supports more than 40 payment gateways, including common options like PayPal. You can also choose whether you want to sell physical or digital products. Squarespace works with all of the leading payment systems, including Stripe, Apple Pay, AfterPay, and PayPal. It also has extra features available for membership sites and service websites, including scheduling tools.

Templates and customization: Squarespace is probably the industry leader for delivering phenomenal, high-quality templates. There are various theme options and frameworks to choose from to suit virtually every industry. Pagecloud also offers a wide range of templates, organized by industry and purpose. The templates are highly customizable, and responsive across all mobile devices and browsers.

Integrations: Pagecloud can integrate with a variety of tools for everything from analytics to donations, and podcast hosting. Squarespace has official integrations for a handful of marketing and sales tools. However, there aren’t as many extensions available from either tool as you’d get from competitors like WordPress, Shopify, or Wix.

Security and reliability: Both Pagecloud and Squarespace promise a strong security posture, with SSL certificates included for your website, encryption for your data, and access controls. You can also leverage PCI-compliant payment tools, and single sign-on with some plans on Squarespace. Both sites offer excellent reliability and uptime.

Omnichannel selling: Pagecloud allows users to connect their website to social media accounts, POS systems, and Amazon or eBay marketplaces. Alternatively, Squarespace can support everything from social media selling, to dropshipping with partners like Printful and Spocket. You can also link your Squarespace site to Amazon.

Analytics and Reporting: While both Squarespace and Pagecloud support business reporting features, Pagecloud doesn’t have its own built-in analytics system. You’ll need to connect your site to Google Analytics to track metrics. Squarespace has a dedicated environment where you can track things like page views, conversions, sales, and bounce rates.

Go to the top

illustration of a cat climbing a ladder

Pagecloud vs Squarespace: Pricing and Plans

Pricing is one of the most important factors you’ll need to consider when deciding which platform to build your website on. Fortunately, both Squarespace and Pagecloud offer a range of plans to suit different needs.

Squarespace Pricing

squarespace pricing

There are 5 pricing plans in total available from Squarespace, and you can save some money on paying for your subscription annually, instead of monthly.

Following a free trial, you can choose from the following plans:

Personal: $12 per month annually or $16 month-to-month for a free custom domain, mobile optimized website designs, templates to suit every need, SEO, unlimited bandwidth, 24/7 customer support, 30 minutes of video storage, up to 2 contributors, SSL security, a video maker, audience management tools and basic website metrics.

Business: $18 per month annually or $26 month-to-month for all the features of Personal, plus integrated ecommerce (with a 3% transaction fee), advanced website analytics, promotional pop-ups and banners, professional email from Google, unlimited contributors, customization with CSS and JavaScript, and more.

Commerce Basic: $26 per month annually or $30 month-to-month for all the features of Business, plus integrated ecommerce (without transaction fees), ecommerce analytics, point of sale integrations, product reviews, customer accounts, advanced merchandising, Instagram, and Facebook selling, limited availability labels, and custom checkouts.

Commerce Advanced: $40 per month annually or $46 month-to-month for all the features of Commerce Basic, plus advanced shipping and discounts, abandoned cart recovery, subscription selling, and commerce APIs.

Enterprise: Custom pricing for all the features you need, customized to suit your specific requirements. The enterprise plan includes SSO, permission controls, advanced collaboration features, custom site tags, scalable uptime, and enhanced security. You’ll also get unlimited storage, and premium customer support.

Pagecloud Pricing

pagecloud pricing

Pagecloud has a total of 7 plans to choose from, separated into “Business” and “Ecommerce” plans. The Business plans are intended for blogs, portfolios, and service websites, while the ecommerce options allow you to sell online. There’s a free plan for Pagecloud, which allows users to build a single one-page website for free. You won’t be able to work collaboratively, or add your own domain on this plan, and Pagecloud branding will be included on your site.

Paid plans include:

Small Business: $20 per month for 1 site with up to 100 pages, 1,000 form submissions per month, 2 team members, a free custom domain and free Google workspace.

Business: $36 per month for all the features of Small Business, plus up to 200 pages per site, 10 team members, 5,000 form submissions, and priority support.

Pro: $79 per month for all the features of Business for up to 5 sites, 1TB of bandwidth per month, site migration services, and expert chat support.

Starter: $29 per month for up to 100 products, 100MB per file (digital goods), service selling and donations, no transaction fees, free SSL, and gift cards.

Advanced: $59 per month for all the features of Starter, plus support for up to 2,500 products, 1GB per file (Digital goods), Amazon and eBay integration, email marketing, variations, and product filters, scheduled order pickups, multilingual catalogs, and volume discounts.

Unlimited: $89 per month for all the features of Advanced, plus unlimited product support, no fees for gift cards, 10GB per file (Digital goods), POS integrations, and expert support.

Go to the top

illustration of a cat climbing a ladder

Shopify vs Pagecloud: Customization and Ease of Use

If you’re looking for a straightforward and intuitive website builder, it’s hard to go wrong with either Pagecloud, or Squarespace. Both of these tools will allow you to design a stunning site with no coding knowledge. However, they also both allow you to dive into the code for your website or landing page content if you want to make more advanced changes.

One thing that makes Pagecloud particularly user-friendly, is that it allows multiple staff members to work on a site at the same time. Plus, there are various helpful videos and pop-ups included within the platform to assist beginners as they build. You can even use a convenient checklist to ensure you have everything you need set up before you launch your site.

Pagecloud offers customizable fonts, colors, and domain name options, with simple drag-and-drop components for bringing your vision to life. There’s also the option to copy and paste segments of HTML throughout your entire site when you want to maintain consistency.

Squarespace is also an extremely straightforward tool for business owners and freelancers. The site asks you a handful of questions when you’re getting started, to ensure you can find the right templates for your needs. There are also designers available to build your site for you if you get stuck, however the same is true for Pagecloud.

You can edit your Squarespace site with a drag-and-drop interface. However, it’s section-based so you can’t place your elements anywhere. You will need to follow a grid system. Overall, however, Squarespace does make it simple to build your website in no time. Plus, it’s simple to add plugins and extra features to connect your site to Amazon, OpenTable, and other channels.

From a web design perspective, Pagecloud does offer a little more freedom. The Pagecloud website builder can even allow you to upload Photoshop components with layers onto your site, and make changes alongside your team members in real-time. However, Squarespace has a slightly broader selection of templates to choose from.

Go to the top

illustration of a cat climbing a ladder

Squarespace vs Pagecloud: Ecommerce Functionality

Both Squarespace and Pagecloud support ecommerce functionality through a range of dedicated plans. You’ll need at least a Business plan on Squarespace to build an online store, while you’ll need to choose one of Pagecloud’s ecommerce plans if you want to sell online.

The WYSISWYG editors for both platforms come with templates specifically intended for ecommerce. Additionally, both tools can integrate with offline POS systems, for omnichannel selling, as well as marketplaces like Amazon and eBay. Both tools also integrate with social media platforms for social selling. However, Pagecloud doesn’t have any dedicated dropshipping tools yet, while Squarespace does have integrations for some popular platforms.

Both Squarespace and Pagecloud also support a range of sales options. You can sell digital products and physical products online with both systems. However, Squarespace is a little more advanced when it comes to supporting service based companies. There’s an Acuity Scheduling system for arranging appointments with customers, and you can create course and membership sites too.

Squarespace also has more advanced features for store management. While Pagecloud has inventory management tools, Squarespace has comprehensive tracking and analytics features, as well as an integration with “Tock” for hospitality industry management.

Go to the top

illustration of a cat climbing a ladder

Squarespace vs Pagecloud: Reporting and Analytics

Compared to other online site builders like Shopify and Weebly, both Squarespace and Pagecloud may appear to have slightly limited reporting capabilities. However, there are options to integrate additional SaaS tools if you need more in-depth insights.

Squarespace also has it’s own dedicated reporting page, where you can track impressions, page views, where your customers come from, and even how many sales you earn with each product. You’ll also be able to create reports with activity logs, traffic overviews, geography insights, traffic source insights, and engagement statistics.

There’s also a dedicated “Commerce analytics” section available on some plans, so you can track revenue, orders, units sold, and even abandoned carts. Unfortunately, Pagecloud doesn’t come close with its analytics and reporting options.

There’s no built-in solution for tracking important metrics on Pagecloud. Instead, you’ll need to integrate your store or website with Google Analytics, and track your information with these tools instead. This could make it harder to get a fully comprehensive view of your company’s growth.

Go to the top

illustration of a cat climbing a ladder

Pagecloud vs Squarespace: Customer Support

Both Pagecloud and Squarespace offer relatively decent levels of customer support. Both platforms even allow you to reach out and request the assistance of service experts and specialists if you need help building or managing your website.

However, if you need direct assistance with something from Pagecloud, you can only send emails to their customer service team. There’s no chat or phone support. Alternatively, you can try looking for solutions to your problems within the company’s FAQs and knowledgebase articles.

With Squarespace, your level of customer support will depend on which plan you choose. In most cases, however, you’ll be able to connect with the team either through live chat or email. There are also various knowledge base and help articles available to guide you in answering your own questions. Plus, Squarespace has some active social media channels too.

Go to the top

illustration of a cat climbing a ladder

Pagecloud vs Squarespace: Which is Best?

Ultimately, Squarespace and Pagecloud can both be fantastic tools for building a compelling online presence. Both solutions are excellent for ecommerce sales and portfolio building. They also make it easy to design phenomenal sites with minimal coding knowledge.

Squarespace is likely to be the ideal option for you if you’re looking for a tool to design a website for a services-based company, hospitality brand, or dropshipping company. It’s also a fantastic choice for professional portfolios and one-page websites.

Pagecloud, on the other hand, is intended more for traditional, yet small ecommerce companies, looking to get started rapidly online. It can integrate with your POS system, and your marketing tools. Pagecloud could also be ideal if you want to build a simple one-page portfolio for free.

Good luck choosing the right solution for your business needs.

The post Pagecloud vs Squarespace: Which is Right for You? appeared first on Ecommerce Platforms.

Putting Gears In Motion: Animating Cars With HTML And SVG

Original Source: https://smashingmagazine.com/2023/02/putting-gears-motion-animating-cars-with-html-svg/

Hello! And if you like HTML, you’ve come to the right place!

I love HTML. As an old-school front-end developer, I think it’s a hugely underrated skill. I’ve been writing HTML since ~2005, and today the browser alone can almost do all the things Flash could do nearly two decades ago!

One such trick HTML now has is called <animateMotion> — those familiar with Flash will remember this as The Motion Guide. I found this video from 14 years ago, but the method existed for a while before that:

The idea is, you create a path for elements to follow… and that’s it!

Here’s an example of what you can do with <animateMotion>:

🚀 Live Preview
⚙️ Repository

If you take a look at the MDN Docs, you’ll see a simple example of a red circle following a path on an infinite loop. The race cars in the live preview follow the same simple rules, and it works just like this!

A simple example of what can be achieved using animateMotion. (See animation)

SVG Using animateMotion

Here’s a simplified version which I’ll use to explain some of the finer details.

Note: I’ve removed some of the path values for brevity, but you can see src for the below snippet at simple-version.html.)

<!DOCTYPE html>
<html>
<head>
<title>Simple Example</title>
</head>
<body>
<main>
<svg viewBox=”0 0 307 184″ xmlns=”http://www.w3.org/2000/svg”>
<g id=”track”>
<g id=”track-lines”>
<path fill=”none” stroke=”#facc15″ d=”M167.88,111.3…” />
</g>

<g id=”pink-car”>
<animateMotion dur=”4s” repeatCount=”indefinite” rotate=”auto” path=”M167.88,111.3…” />
<path fill=”#EC4899″ d=”M13.71,18.65c0.25-0.5…” />
</g>
</g>
</svg>
</main>
</body>
</html>

The first thing to look at is the <g> element with the id of track-lines. This is the yellow dashed line that represents the path the car will follow.

You’ll also see another <g> element with the id of pink-car. Within this group is the <animateMotion> element. It has an attribute of path. The numbers used to form this path are the same as the numbers that form the track-lines. An <animateMotion> element is invisible, and its only purpose is to provide a path for an element to follow.

Speaking of which, below the <animateMotion> element is another <path> element, this is the pink car, and it will follow the path of its nearest neighbor.

animateMotion Attributes

There’s some additional attributes that the <animateMotion> element accepts; these are as follows:

dur: The duration of the animation.
repeatCount: The number of times the animation should loop.
rotate: This can be considered as an orientation to the path. It will ensure the element that’s animating around the path always faces the direction of travel.
path: As explained, this is the actual path an element will follow.

The MDN Docs show the <animateMotion> element as a child of an Svg <circle> shape e.g:

<circle r=”5″ fill=”red”>
<animateMotion
dur=”10s”
repeatCount=”indefinite”
path=”M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z” />
</circle>

Whilst this approach works for shapes, it will only work if the element can accept a child. The SVG path element can’t, so wrapping everything in the <g> element allows HTML to work out where the coordinate system should start and which elements should follow the path. Sneaky ay!

And that’s it. I designed the track and the other elements seen on the preview link in Adobe Illustrator and exported the whole thing as an SVG. I then did a little bit of manual refactoring to ensure the cars were adjacent to an <animateMotion> element. Et voilà! A race track!

Accessibility

One small snag, the <animateMotion> element doesn’t natively observe prefers-reduce-motion. To work around this in the preview I’ve added a media query that sets any element with the class name of car to display: none;. Not ideal, but it is at least motion safe!

I hope you’ve enjoyed this post, and if you have any questions, please come and find me on Twitter. @PaulieScanlon, oh and if you’re a better illustrator than I am, please, feel free to re-design the race track and cars, and I’ll be happy to convert it into code!

See you around the internet!

Further Reading On SmashingMag

“How To Build A Real-Time Multi-User Game From Scratch,” Martin Grubinger
“Easy SVG Customization And Animation: A Practical Guide,” Adrian Bece
“Composable CSS Animation In Vue With AnimXYZ,” Ejiro Asiuwhu
“A Guide To Keyboard Accessibility: HTML And CSS (Part 1),” Cristian Díaz

How To Get a User’s IP Address With PHP

Original Source: https://1stwebdesigner.com/how-to-get-a-users-ip-address-with-php/

In PHP, there are several methods to retrieve a user’s IP address. We will explore two of those ways in this article.

UNLIMITED DOWNLOADS: 500,000+ WordPress & Design Assets
Sign up for Envato Elements and get unlimited downloads starting at only $16.50 per month!

DOWNLOAD NOW

 

The most reliable way to get a user’s IP address in PHP is to use the $_SERVER superglobal variable.

The $_SERVER superglobal variable contains information about the server environment, including the user’s IP address. Here’s an example:

<?php
$ip = $_SERVER[‘REMOTE_ADDR’];
echo $ip;
?>

The $_SERVER[‘REMOTE_ADDR’] element returns the IP address of the client (i.e., the user’s device) that is making the request to the server. This method works well for most cases, but there are a few situations where it may not return the correct IP address, such as when the user is behind a proxy server or using a VPN.

To handle these cases, it is recommended to use the following code to get the user’s IP address:

<?php
function get_client_ip() {
$ip = ”;
if (isset($_SERVER[‘HTTP_CLIENT_IP’])) {
$ip = $_SERVER[‘HTTP_CLIENT_IP’];
} elseif (isset($_SERVER[‘HTTP_X_FORWARDED_FOR’])) {
$ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’];
} else {
$ip = $_SERVER[‘REMOTE_ADDR’];
}
return $ip;
}

$ip = get_client_ip();
echo $ip;
?>

In this code, we first check if the $_SERVER[‘HTTP_CLIENT_IP’] element is set. If it is, we use its value as the user’s IP address. If not, we then check if the $_SERVER[‘HTTP_X_FORWARDED_FOR’] element is set. If it is, we use its value as the user’s IP address. If neither of these elements is set, we use the $_SERVER[‘REMOTE_ADDR’] element as the user’s IP address.

This method provides a more robust solution for retrieving the user’s IP address, as it takes into account the possibility that the user may be behind a proxy server or using a VPN.

Learn more here.

17 Best PayPal Alternatives for 2023: Top Solutions Reviewed

Original Source: https://ecommerce-platforms.com/articles/paypal-alternatives

PayPal was once one of the most revolutionary pieces of technology in the world. Back in the late 1990s and early 2000s, there wasn’t much interest in PayPal alternatives.

That’s because PayPal not only allowed you to send and accept money from friends and family, but it ensured that the money was far safer than many other options you could choose from. This came in handy once eBay emerged, considering both sellers and buyers were concerned about fraudulent activity.

In addition, PayPal has some solid invoicing, ecommerce, payment processing and reporting tools, letting you accept payments for services and products without any problems. It’s no secret that the PayPal interface is still pretty solid, but younger, more agile competitors have drastically improved upon what PayPal initially built. And one of the main reasons PayPal is still so popular is that people are just accustomed to it. Yet, several other PayPal alternatives are available with lower rates, better customer service, and even stronger interfaces.

The Best PayPal Alternatives

Here’s a quick list of the best PayPal alternatives. Each link leads you to the more in-depth reviews of each one.

Square – Best PayPal Alternative for Businesses

Shopify Payments – Best PayPal Alternative for Ecommerce

Payline – Best for Interchange Pricing

Wise – Best for Personal Use and International Payments

Verifone – Best for Global Payments

Payoneer – Best PayPal Alternative for Freelancers

Skrill – Best PayPal Alternative for High-risk Industries

Stripe – Best PayPal Alternative for Small Business

Google Pay – Best PayPal Alternative for Consumer Shopping

Authorize.Net – Best for Top-notch Customer Support

QuickBooks Payments – Best PayPal Alternative for Easy Taxes and Expense Tracking

Dwolla – Best PayPal Alternative for Bank Transfers

Braintree – Best for Customizing Your Payment Processor

WorldPay -Another Great Alternative for Global Payments

Amazon Pay – Best PayPal Alternative for Online Selling and Shopping with Saved Payment Methods

Klarna – Best PayPal Alternative for Customers To Pay in Installments

WePay – Best Alternative for Crowdfunding

Btw, here’s a video version of the tutorial created by my colleague Joe. 🙂

YouTube video

Square – Best PayPal Alternative for Businesses

Square is a PayPal alternative

Square is one of those prominent alternatives that often comes up whenever you’re comparing PayPal with other solutions. And there’s a good reason.

You see, Square is not just a regular payment processor. It offers an online store plus domain for free, and then combines that with shopping cart integrations, as well as invoicing, card data storage vault, and virtual terminal features. And for card processing, you get POS and mobile POS integrations for free.

Although Square doesn’t support selling in as many countries as PayPal, the list is strong and growing:

US

Canada

Australia

Japan

United Kingdom

Republic of Ireland

France

Spain

So the locations are a bit limited, but merchants in those areas benefit from a full online processing suite with notable add-ons like invoicing, marketing tools, social media integrations, loyalty programs, and even standard banking options.

As far as transaction fees are concerned, Square maintains the standard rates we’ve seen with most other processors. In-store card processing, for instance, has a 2.6% + $0.10 transaction fee, while online and invoiced payments cost 2.9% plus $0.30 per transaction.

All in all, Square provides top-notch value as a payment processing solution.

Pros

It comes with a free domain and online store. This is one of the very few online stores you can get for free with no stipulations. It’s also very easy to set up.

Square is a comprehensive all-in-one payment solution.

There are extra add-on services for growing businesses.

Square does not charge any monthly fees.

The features are particularly favorable to low-volume merchants.

They’re transparent with transaction fees, and stick to industry-standard rates, which are pretty affordable.

Send invoices to clients.

Manage your business banking through the same company.

You can customize every aspect of your checkout with the Developer documentation and API.

You get plenty of free hardware from Square and have the option to purchase more hardware.

Cons

As a payment gateway, Square is only available in 8 countries at the time of this article.

Some users complain about the quality and color of Square card swipers, saying the standard white color gets dirty easily, and it occasionally lags when processing cards.

It’s not ideal for high-risk merchants. In fact, you probably won’t even get accepted.

Who is it Best For?

As a PayPal alternative, Square works best for businesses accepting payments online or in-person. Not only do you get a free online store, but Square offers smooth payment processing with reasonable fees, a physical card swiper for accepting payments in the real world, and a variety of add-on services made just for businesses.

Read our full Square Review here. 

Go to the top

illustration of a cat climbing a ladder

Shopify Payments – Best PayPal Alternative for Ecommerce

Shopify Payments is a paypal alternative

If you’ve used Shopify to build and manage an online store, you’re probably familiar with Shopify Payments. It’s a built-in payment processing system that comes by default as part of the whole Shopify platform.

Therefore, you don’t have to worry about integrating with an external payment gateway. You can simply manage your transaction processing system right from Shopify’s main dashboard. The result is a one-dashboard management system for payments, inventory management, and website design.

And Shopify Payments is not only about online payments. It also offers POS hardware to support in-store payments and sync those transactions with an online store.

Another reason Shopify Payments stands out is because of its 0 transaction fees and tiered credit card fee system (that gets cheaper as your business grows). While using PayPal on Shopify costs 0.5-2% in transaction fees, and that’s before the credit card fees (usually around 2.9% +$0.10 per transaction). Shopify Payments offers 0 transaction fees. And it’s the easiest payment gateway to install on the Shopify ecommerce platform.

In addition, the extra credit card fees get capped at 2.9% + $0.30 per transaction, and they go as low as 2.4% + $0.30 depending on your Shopify plan. Learn more about Shopify pricing here.

Finally, Shopify Payments sends payment to your bank account in as little as 1 day, with final funds landing in your account in 1-4 days. PayPal takes about 5-7 business days.

Pros

It’s built into the Shopify ecommerce platform to offer a seamless payment management experience.

Shopify Payments has 0 transaction fees and decreasing credit card rates as your business grows.

You get your funds much faster with Shopify Payments than PayPal.

It works well with many accounting applications to help with accounting and reporting.

You can accept all the standard payment methods, along with alternative methods like Google Pay and Apple Pay. It’s even possible to still add a PayPal button on your store.

It’s one of the easiest payment gateways to configure, seeing as how the sign-up process only takes a few minutes after you type in banking information.

The Shop Pay feature lets customers save their payment and contact information for rapid checkouts later on. Shop Pay data is also useful on other merchant websites.

Cons

You can only install Shopify Payments if you use the Shopify ecommerce platform for your online store.

Shopify Payments is only available in a few countries.

There have been user reports of accounts getting frozen without warning.

Who is it Best For?

Shopify Payments works well for online stores, period. It’s a wonderfully simple payment processor (powered by Stripe) through the Shopify ecommerce platform. That means we can really only recommend it to merchants who use Shopify as their ecommerce platform. So, if you currently use Shopify, or plan to switch to the platform in the future, Shopify Payments makes a significant amount of sense because of its extremely low fees (based on your payment plan), seemless integration with Shopify, and fast approval.

Read our complete Shopify Payments review.

Go to the top

illustration of a cat climbing a ladder

Payline – Best for Interchange Pricing

Payline

Payline is a payment processor that offers a diverse range of solutions, including mobile, online and in-store payments.

Payline works as one of the best PayPal alternatives for both online and in-person payments. It’s cheaper and way more flexible than PayPal, particularly for in-person transactions.

Payline does not use a standard static pricing schedule, allowing for a more transparent, flexible fee structure. They accomplish this through an interchange plus pricing system, where the fees vary consistently based on the payment methods you end up processing.

That said, the interchange model is, undeniably, the most transparent in the payment processing space. The only challenge you might face, however, is forecasting your future expenses.

PayPal fees have increased over the years (reaching around 3.49% + a fixed fee for online transactions), so you’re bound to incur less with Payline.

Now, the features you get for card processing depend on the package you settle for. If a mobile card reader is your kind of thing, then Payline’s mobile app and card reader packages work well. They also have options for invoicing, scheduling, recurring billing, and full POS systems, all of which are affordable and well-tailored for small business owners.

Here’s a general idea of how Payline pricing works:

In-person: Interchange + 0.2%, which means $0.10 per transaction and a $10 per month fee (this is the interchange calculation) plus an extra 0.2%.

Online: 0.4%, or $0.02 per transaction with a $20 per month fee, plus 0.4%.

Taht may sound a little confusing, but it often ends up saving merchants a significant amount of money. And Payline has a payment calculator to predict your fees.

Pros

The interchange plus pricing structure is not only flexible but also very transparent.

Payline offers a wide range of in-store credit card processing packages, complete with robust hardware.

Payline’s offline transaction fees are cheaper than PayPal’s. It’s also almost always cheaper to use Payline for online transactions.

It offers a fully featured API to integrate with third-party solutions and platforms.

Payline supports mobile payments and offers wonderful mobile payment hardware.

You can integrate with most popular ecommerce platforms.

Send invoices, or create plans for recurring billing and scheduling.

The deposit speed ranges from 1 to 2 business days.

Cons

So far, Payline is only available in the U.S.

It’s difficult to forecast the fees you stand to incur through the interchange plus pricing model.

Payline’s ecommerce payment processing features don’t match up to PayPal’s.

Who is it Best For?

Payline boasts a transparent interchange fee structure for online store transactions, invoices, recurring payments, and in-person payments, making it ideal for those who are looking for a deal and a full view as to how much they’re being charged for their payment processing.

Read our Payline Data review.

Go to the top

illustration of a cat climbing a ladder

Wise – Best for Personal Use and International Payments

Wise (formerly known as TransferWise) is a much cheaper alternative to PayPal for international transfers (see their comparison tool vs PayPal). Their multi-currency, borderless account helps consumers, freelancers, and online businesses send, receive, and spend money across borders with minimal fees.

Wise works like this: It cuts out sneaky hidden charges and sticks to one upfront transfer fee. It’s also interesting how the money gets moved around. For instance, let’s say you’re in the US and want to send money to a friend in France. You make the payment and the money goes into Wise’s American bank account. It then pays your friend from the Wise France bank account using the real exchange rate. Therefore, the money never actually crosses borders—keeping rates even lower and making the transfers rather fast.

Wise has made a name for itself in the international transfer game, but it also provides an international business banking account for ecommerce. This means you can accept cross-border payments for services and goods, while also linking to Stripe and Amazon for additional payouts.

Pros

Wise is one of the most accepted and cheapest tools for making international money transfers.

You can accept payments for services and products without the high fees from PayPal.

During our testing, Wise was often close to 19x cheaper than PayPal.

Distribute payments to multiple international contractors in one click.

Wise has payment links to send clients.

Very transparent pricing.

Their borderless account allows you to hold and transfer more than 40 currencies.

With Wise for business you can invoice your customers in the currency that works for them. This feature also has a debit card, API, and support for over 70 countries.

The money never actually crosses borders, so you can keep down costs and ensure fast transfers.

Cons

You must have a bank account to receive a transfer. However, payments are possible with ACH, wire transfer, debit card, credit card, ACH, or one of the many digital wallets.

You can only receive money in EUR, USD, AUD, and GBP with the borderless account.

Wise isn’t a payment gateway that you would install on your ecommerce store. It’s more for freelance and contract payments, or if you plan on invoicing for B2B transactions. It also makes sense when paying suppliers.

Who is it Best For?

Wise dominates PayPal when it comes to fees. Not only do they provide complete transparency when making transfers, but they cut out the usual fees that come with sending and receiving international money through PayPal. This makes it ideal for personal money transfers (international or domestic), and for accepting payments for freelancing and contracting work. Essentially, you’re able to eliminate many of the fees associated with PayPal invoicing, and we’ve yet to find a less expensive alternative besides Wise.

Read our full Transferwise Review here. 

Go to the top

illustration of a cat climbing a ladder

Verifone – Best for Global Payments

verifone

Verifone (formerly 2Checkout) is one of our favorite PayPal alternatives, mainly because it’s all about accepting payments globally. As we said a bit about PayPal in the introduction, you’re still somewhat limited to the countries you can accept payments from through PayPal. Verifone looks to change that. The fees in the US are exactly the same as PayPal, but we’ve found that other countries enjoy better rates when accepting payments from customers. You can calculate the payment pricing to see if Verifone is more affordable than PayPal in your country.

As for ecommerce processing, Verifone provides an excellent shopping cart tool to sell digital goods online. Its retail module has options to accept payments online, in-person, and or anywhere you want. With support for over 200 countries, and a dashboard that’s easier to understand than PayPal’s. we highly recommend Verifone, especially for global payment processing.

Pros

You don’t have to pay any monthly or setup fees.

Accept major payment methods, including credit cards, debit cards (Visa, MasterCard, Maestro), and PayPal.

Choose from 87 currencies, eight payment types, and 15 languages. There’s support for selling from over 200 countries.

The advanced fraud protection goes through over 300 security rules for each transaction.

Several customizable checkout options are available. The checkouts are also mobile-friendly, branded, and localized.

Setup recurring billing for your customers.

Connect your merchant account with a payment gateway.

Integrations include over 100 online carts, an API, and a sandbox.

Cons

The transaction fees aren’t the lowest you’ll find: 3.5% + $0.35 for the 2Sell plan.

$20 is charged on your account for all chargebacks.

The average fee for currency conversion is 2-5% above the daily bank exchange rate.

The digital goods plan has a transaction fee of 6% + $0.60, which is far too high.

Verifone is one of the best alternatives to PayPal, and we mainly like it because of its international payment support. It doesn’t matter where you’re located, so you shouldn’t have any problems.

Who is it Best For?

Whether you’re selling products through online retail, or you run a store with digital goods, Verifone handles global payments with ease. It’s not the least expensive option on this list, but we’re impressed by its support for over 200 countries, 15 languages, and 8 payment types, along with its advanced security to minimize international fraud attempts.

Read our Verifone review for more info.

Go to the top

illustration of a cat climbing a ladder

Payoneer – Best PayPal Alternative for Freelancers

Payoneer is one of the top PayPal alternatives

Payoneer looks somewhat similar to Skrill (listed below) since you get a debit card and an online account. Shopping online is a breeze, and sending and receiving money only takes one step. The main benefit is with the debit card. Going to the ATM is possible, and you can also walk into a brick and mortar store to use your Payoneer account.

Payoneer has also expanded into the global payments market, offering tools for getting paid and sending payments to and from clients and marketplaces.

In terms of ecommerce payments, Payoneer functions more like Wise, where you can create a payment link and accept international transfers from customers, but it’s not a complete payment processor that you’d add to a shopping cart.

Pros

It has some handy tools and integrations for freelancers who would like to accept money from clients. This is particularly true for international payments.

You can use Payoneer anywhere in the world.

The transaction process doesn’t require any programming knowledge. You can implement the system on your website and get your money fast.

It also doesn’t take long to set up an account.

Getting access to your funds is easy through your own bank account or through an ATM.

The pricing is simple (monthly billing) and great for payments between Payoneer accounts (it’s free).

Request payments with your own payment link and set up receiving accounts for contractors and suppliers.

Cons

The jury is still out on the customer service. Many people online say it’s not that great.

When transferring to a bank account, you generally have to pay a fee. This is a huge downside since most other systems like PayPal have this for free.

You won’t find any payment gateway with Payoneer.

Accepting credit cards will result in a high fee.

If you go to the ATM you should expect to pay a large fee.

Who is it Best For?

Although we primarily recommend Wise for freelancers, Payoneer also has a solid reputation for those freelancers that need to send out invoices and cut down on the outrageous fees imposed by PayPal. Essentially, Payoneer allows you to bypass high processing fees and international conversion fees. It’s easy to transfer money to workers around the globe, while also accepting payments from other countries.

Go to the top

illustration of a cat climbing a ladder

Skrill – Best PayPal Alternative for High-risk Industries

Skrill

With similar rates and fees as PayPal, the Skrill platform may seem the same at first. However, the prepaid debit card and the simple interface are enough to consider Skrill. International payments are far easier with Skrill since the money can be sent and transferred immediately to a debit card that the company sends you. Then you can use the debit card wherever you want, including ATMs.

The Skrill Business account offers unique tools for hosting a quick checkout on your ecommerce store, while also providing digital wallets, rapid transfers, and shopping cart integrations. It’s also possible to connect with the Skrill API for full customization. Along with competitive processing fees and enhanced fraud management, Skrill definitely serves as one of the top PayPal alternatives.

Pros

The account setup is one of the easiest in the business.

The security is solid and offers high-quality fraud and risk management.

Uploading and receiving funds, while also spending money at Skrill merchants, is almost always free.

Users can take their Skrill account around the globe.

All you need to make or accept a payment is an email address.

Skrill has a full system set up for gambling and playing games with money, so it’s a good solution for those options.

You can integrate with several ecommerce platforms to offer a friction-less multi-currency payment gateway.

Skrill has digital wallets and rapid transfers to your bank account.

Skrill supports some of the most unique international payment methods, such as HSBC, Oxxo, and CartaSi.

Cons

Sending money to an email address or another Skrill wallet costs 1% of the amount sent, with the charge capped at $10.

The company has rather strict fraud prevention tools, so you may end up finding that your account is frozen. However, this has happened at PayPal too.

Reports have shown that the customer service isn’t the best at Skrill.

Who is it Best For?

Skrill handles global payments, and it offers an intuitive platform for setting up your accounts. The overall idea is not so much to minimize costs but to improve the accessibility to payment processing for international brands and those that work in high-risk industries; think gambling and alcohol—these are industries that often have trouble finding a payment processor to work with.

Read our comprehensive Skrill review.

Go to the top

illustration of a cat climbing a ladder

Stripe – Best PayPal Alternative for Smal Business

Stripe is a PayPal alternative

Stripe is probably the most popular of all the PayPal alternatives, and you’ll notice that some ecommerce platforms state Stripe as their preferred payment processor. For example, Squarespace has been working with them for a long time and now Shopify provides its Shopify Payments system through Stripe. The whole point of Stripe is that it eliminates the need for a merchant account and gateway.

Everything is handled by Stripe, from collecting payments to sending those payments to the bank (including ACH payments and Bitcoin transactions). It’s one of the more streamlined alternatives out there and it’s no wonder so many platforms partner with them. And Stripe has maintained its industry-standard transaction fees (2.9% + $0.30), whereas PayPal has failed to keep those rates.

Pros

Stripe automatically puts your transaction money in a bank account.

Mobile payments are available.

Accept payments from people and companies all over the world.

Real-time fee reporting is available.

Only pay for what you use.

The pricing is fairly transparent, with no setup, hidden, or monthly fees.

Apple and Android Pay are supported.

The fees have remained the same for quite some time.

Collect payments through an online store with one of the easiest to use payment gateways.

You have direct access to an API for customizations and integrations.

Cons

You generally have to wait a few days after a transaction to gain access to the money.

Although you can accept payments from all over the world, merchant accounts are only available to the US, Canada, UK, Australia, and many European countries.

The interface may require some programming knowledge, but that’s usually only when working with the API.

International cards require an additional 1% transaction fee.

Who is it Best For?

Stripe makes so much sense for small businesses because of its welcoming interface, customization options, and the ability to accept payments in-person, online, and all over the world. We also like that payouts happen fast, which is an essential part of of improving cash flow for small businesses. Not to mention, you can integrate Stripe with just about any platform, whether it’s for client invoicing or in your online store.

Read our full Stripe review here. 

Go to the top

illustration of a cat climbing a ladder

Google Pay – Best PayPal Alternative for Consumer Shopping

Google Pay

Google Pay is by far the best choice if you’d like a place to store and use your debit and credit cards. Spending money is easy online, and you can also put all of your cards on your phone for spending at physical locations.

The business portion of Google Pay requires a separate POS and payment processing system, but accepting Google Pay gives your customers a speedier checkout (both offline and online) and more options for payment. There are also plenty of ways to expand your business with Google Pay, including linked offers, enrollment features, and ticketing.

Pros

Google Business allows you to accept Google Pay from your customers, whether it be on your website or a physical store.

It only takes a moment to send out or receive payments.

Sending out payments from your smartphone is the primary feature, and it can be done online or in person.

There aren’t any fees, and your customers don’t get charged anything extra.

Access to the API enables features like enrollment, linked offers, and smart tap.

Cons

It’s still limited to only iPhones and some Android phones.

Many people still question the security of mobile wallets like this.

There’s no payment processing system or shopping cart for businesses.

Who is it Best For?

We recommend that all retail and online merchants accept Google Pay, since it’s simply another payment method for customers. However, the main reason we like Google Pay as a PayPal alternative is for online and in-person shopping. Essentially, Google Pay serves as a digital wallet where you can save your payment methods (like credit and debit cards) and also keep all of those methods safe on your phone. Consumers also enjoy no fees and options to send money to any business or person.

Go to the top

illustration of a cat climbing a ladder

Authorize.Net – Best for Top-notch Customer Support

Authorize.net

The Authorize.Net system is rather popular with online stores, as the platform provides reasonable rates, quality customer service, and an interface that pretty much anyone can use. Although you don’t have the ability to send and receive payments from friends and family, it’s a quality PayPal alternative for those who would like to accept payments and get in on the most widely used gateway on the planet.

Authorize.net has products for ecommerce, point of sale, mobile payments, and phone payments. You can also use its tools for billing, eChecks, and mobile card reading. It’s an incredibly popular payment gateway for international business, since Authorize.net support more countries than competitors like Stripe and Square.

Pros

Over 400,000 merchants use Authorize.Net, so they’ve got to be doing something right.

The reliability and security are far above the competition.

A free mobile app and swiper come along with your account.

The free 24/7 support is the best in the business.

You have the ability to sync with QuickBooks.

There aren’t any setup fees for a payment gateway or merchant account.

Integrate with hundreds of online store builders.

Accept payments through ecommerce stores, phone transactions, and invoices.

Cons

You don’t get the personal finance and sending tools you would get in PayPal.

There’s a monthly gateway fee of about $25.

If you sell globally, add a 1.5% assessment for international transactions.

Chargebacks are $25.

Who is it Best For?

Authorize.net makes sense for a wide variety of reasons, but particularly for accepting payments through an online store. It’s one of the more established payment gateways with advanced security, high-quality customer support, and seemless online payment tools meant to streamline payments for your business. If you’ve ever found payment gateways a pain to deal with, Authorize.net is the answer to your questions. It’s a premium service that gives you far more documentation and support than you would ever get with PayPal or Stripe.

Learn more on our Authorize.Net review here.

Go to the top

illustration of a cat climbing a ladder

QuickBooks Payments – Best PayPal Alternative for Easy Taxes and Expense Tracking

QuickBooks Payments

Intuit could potentially provide you with a whole suite of tools depending on what you need for your business. It’s popular, and you can get paid with the QuickBooks tool. It’s also one of the best solutions if you plan on integrating with QuickBooks for the accounting functionality as well.

Rates remain simple from QuickBooks, with 1% fees for ACH bank payments, 2.4% fees for swiped cards, and 2.9% fees for invoices. Other features include recurring invoices, eCheck support, and contactless payments.

Pros

Integrate with QuickBooks.

Gain access to TurboTax.

Send invoices just like PayPal. You can also make those invoices recurring.

Get paid anywhere with mobile payments.

You can include a Pay Now button on your website. Or integrate with a shopping cart.

Accept ACH bank transfers.

Connect your payments with timesheets and payroll.

Cons

The rates are not competitive enough if you’re not working with QuickBooks.

This isn’t what you would want to go with if you’re only looking for something for your personal sending and accepting.

We also don’t like QuickBooks for most ecommerce setups. It’s best for invoicing.

Who is it Best For?

QuickBooks isn’t an exact alternative for PayPal, but it solves some of the problems you may have when sending invoices, tracking those transactions, and getting them ready for tax time. PayPal is a mess when it comes to taxes, so QuickBooks turns that into an easier process. For freelancers, small businesses, and online stores, QuickBooks is wonderful for invoices, accepting mobile payments, tracking all revenue, and sending it to TurboTax during tax time.

Learn more on our QuickBooks Payments review.

Go to the top

illustration of a cat climbing a ladder

Dwolla – Best PayPal Alternative for Bank Transfers

Dwolla

Dwolla may not initially come up on your radar, but it’s worth a look because it works so similarly to PayPal. Although you do have the ability to send and receive payments from companies and individuals, the best part is that the company specializes in ACH bank transfers. It’s by far your best option if you plan on accepting or sending lots of bank transfers.

Unlike PayPal, Dwolla is not a card processing solution. Instead, it facilitates fund transfers by linking directly with your bank account.

Now, the good thing about eliminating cards is this: the cost of transactions is kept low. In fact, Dwolla’s principal objective is helping everyone with a web-enabled device to send money at the lowest price possible.

And to achieve that, Dwolla does not charge even a cent to process funds under $10. Above that, every single transaction will cost you a fixed rate of $0.25. It really is that simple.

Overall, it makes PayPal’s fees seem outrageously high, especially when you’re handling a large number of transactions. A merchant who happens to process 10 transactions worth $100 each, for instance, would only incur $2.50 with Dwolla. In contrast, PayPal would deduct a close to $40.

Pros

The branding tools are powerful and easy to use.

Making a bank transfer is super easy.

Next day transfers are offered for a flat fee.

The transaction fee is only $0.25, and they offer pay-as-you-go pricing or scale pricing.

You can access the Dwolla API for superior integrations.

Lets the sender pay the transaction fee if needed.

An instant cash transfer is offered.

You can automate mass payouts, like if you’re running a marketplace.

Cons

You can’t make payments if both the sender and receiver aren’t using Dwolla.

You can’t make an account with Dwolla if you’re located outside of the United States. However, it is possible to initiate cross-border payments with the specialty CurrencyCloud feature.

Dwolla Business has monthly fees and they aren’t cheap.

Who is it Best For?

Dwolla makes ACH transfers a breeze. Not only can you tap into the API for customizations, but the standard product works wonders for sending money from bank to bank, especially if you’re handling those types of transactions for freelancing or contracting. Finally, Dwolla keeps fees pretty low, so you musn’t worry about cutting into your revenues just because you have to use an online payment processor.

Read our comprehensive Dwolla review.

Go to the top

illustration of a cat climbing a ladder

Braintree – Best for Customizing Your Payment Processor

Braintree

Along with a payment gateway and recurring billing, the Braintree system provides a way for you to store your credit cards, similar to Google Pay. Although some more personal finance features are packaged into Braintree, we like it best for merchants. 

Braintree is owned by PayPal, but it still runs as a fairly independent company. Having said that, some of the best features and products include the option to accept payments for products and service through an online store, authorization tools for granting permissions to 3rd parties, and marketplace payments.

Pros

The pricing is simple and straightforward.

Collect recurring billing and store credit cards.

Braintree accepts all sorts of payment methods, including PayPal, cards, and Venmo.

You get a far more advanced list of features than you do with PayPal.

The customer support has been known to be rather solid.

Both online and mobile payments are allowed.

The authorization tool lets you grant permission to 3rd parties for seamless integrations and payments.

There’s a special marketplace payments system.

Braintree offers built-in fraud protection, reporting, and data security.

Cons

If you’re planning on implementing Braintree on your website it may require you to have some sort of programming knowledge.

A separate merchant account is required for the system to work.

Although the main fee is for transactions, there is a large list of other fees that you have to think about.

Who is it Best For?

Braintree was built with developers in mind, so it’s definitely a solution we like for companies with custom payment needs. For example, it’s nice for when you want to customize the entire checkout process in an online store. You can also configure recurring billing or store credit cards from payers.

Read our comprehensive Braintree review.

Go to the top

illustration of a cat climbing a ladder

Worldpay (from FIS) – Another Great Alternative for Global Payments

WorldPay - PayPal alternatives

Previously known as RBS Worldpay, this is a payment processing platform that supports a host of payment options, including credit cards and debit cards. Its network extends globally, consequently making it a major PayPal competitor.

The main similarity between the two is that they primarily support both online and offline card transactions. So, you can leverage Worldpay in your ecommerce business as well as in-store, just like PayPal.

When it comes to offline payments, however, it turns out Worldpay is built to support a wide array of channels. You can take advantage of its POS systems plus ATM processing, as well as its mobile payment function to accept credit card payments and cash.

Worldpay then extends the same level of diversity to its pricing schedule, which has been structured to offer both tiered and interchange plus packages. The corresponding amount you end up paying per month depends on both your average monthly processing volume and transaction history.

Pros

Just like PayPal, Worldpay has an extensive global payment network.

It supports a host of offline processing options.

The pricing schedule is flexible.

You can take advantage of interchange-plus pricing for increased transparency.

Worldpay offers 24/7 customer support.

You can take, make, and manage payments from one dashboard.

They even have robust wealth management and capital services.

Cons

Terminating the service early will cost you a fee of $295.

You have to commit to a contract for three years.

Its free terminal offer is misleading.

You must contact a salesperson before signing up for an account.

The website isn’t all that intuitive, making the offerings seem hidden or hard to find.

Who is it Best For?

Similar to Verifone, Worldpay manages global payments with its extensive global payment network. This results in a transparent, interchange fee structure, along with a pricing schedule that’s flexible, allowing you to keep an eye on how much is being spent on payment processing. Overall, it’s a nice option for international payments, whether you’re accepting those payments through an online store, offline, or through invoices. You can even move your money to Worldpay’s wealth management services.

Learn more on our WorldPay full review.

Go to the top

illustration of a cat climbing a ladder

Amazon Pay – Best PayPal Alternative for Online Selling and Shopping with Saved Payment Methods

Amazon Pay - PayPal alternatives

To let people checkout of your online store, Amazon Payments is at the top of the list. It expedites the whole process, similar to something like PayPal (but not ACH payments or bitcoin transactions). We like to compare it to a Facebook login, where all of the user information is already stored. Therefore, the login, or checkout (with Amazon Payments) is going to be much faster than that of a regular shopping cart and checkout.

On the other side of the transaction, Amazon Pay helps merchants keep customers engaged while also reducing chargebacks and fraud. You can integrate an Amazon Pay button into your online store to accept payments with ease. It’s also possible to use for in-store payments.

Pros

The transaction fees are lower than PayPal.

The security is very advanced compared to other competitors.

If you start with an Amazon account, the interface and signup process is easy.

Everyone is familiar with Amazon, so your customers will have it easy when paying.

Amazon Pay integrates well with most ecommerce platforms.

Merchants can offer a one-click payment process for customers with Amazon accounts.

Cons

There are some random fees like domestic processing fees and cross-border processing fees.

Integrating with your online store may take a little programming knowledge, but many payment gateways, like Stripe, make it easy to integrate with Amazon Pay.

Who is it Best For?

Amazon Pay is a winner for both merchants and shoppers, because it allows customers to save their payment details and log into their accounts with one click. This way, they have a more secure storage solution, and they don’t have to type in their payment credentials whenever they want to make a purchase from an online store. What’s more is that online merchants can add Amazon Pay as a separate payment option (like you would with PayPal or Google Pay), giving customers the option as to how they want to checkout.

Go to the top

illustration of a cat climbing a ladder

Klarna – Best PayPal Alternative for Customers To Pay in Installments

Klarna - PayPal alternatives

Klarna offers personal finance and business tools for paying however you like, finding deals, and processing payments from customers. The idea behind Klarna’s business tools is to convert and retain customers with unique payment options like financing and installments. Overall, Klarna isn’t exactly a direct competitor of PayPal, but it gives customers another, more flexible payment option.

The entire customer financing process is made possible by Klarna’s AI system, which quickly analyzes an individual’s potential risk based on their details, as well as the time of purchase, and transaction history. It subsequently approves or denies the purchase within a couple of seconds, and then order fulfillment follows. Ultimately, the customer is given 14 days to clear the payment.

Well, this means that while customers are able to shop conveniently, most of the risk is incurred by Klarna. In other words, this payment processor is deeply involved in your ecommerce order fulfillment process.

Interestingly, you don’t even have to sign up with the service to connect directly with banking. You can simply proceed with your standard online banking details plus authentication, and voila! Payment is immediately transferred to the merchant account.

Compare that with the inconvenience of registering on PayPal and then loading your account, before you’re finally able to conduct transactions.

Pros

Customers can purchase products and complete the payment after delivery.

The checkout process is conveniently easy.

Shoppers are allowed to pay for their orders in installments.

Customers don’t have to pay for anything in the event products are returned.

Merchants are paid by Klarna upon checkout.

Cons

Purchases can be declined without any concrete reason.

Klarna’s customer support is not adequately responsive.

Customer refunds might take some time.

Who is it Best For?

Sure, Klarna offers features for customers to find deals, but it’s primarily a way for online shoppers to pay in installments. We like this for merchants that sell more expensive items, considering you can give your customers an easier way to purchase your products. Not only that, but getting listed on the Klarna app means that you’re more visible to shoppers who use Klarna.

Read our comprehensive Klarna review.

Go to the top

illustration of a cat climbing a ladder

WePay – Best Alternative for Crowdfunding

wepay - PayPal alternatives

Launched to compete directly with PayPal, WePay is a card processing solution that focuses mainly on online payments.

Owned by Chase, WePay offers integrated payment systems for online marketplaces, POS systems, and software companies. The API-first development process means you can integrate WePay in with all of your tools. You can also look forward to same-day deposits, a customer risk engine, and integrations with platforms like Meetup, Constant Contact, and Bigcommerce.

Pros

WePay provides a flexible API.

You can get your account up and running pretty quickly.

It’s well-tailored for crowdfunding.

WePay supports a diverse range of online payment options.

ACH payment processing is cheap.

There are no monthly charges to use WePay.

It integrates with quite a few email marketing and finance tools.

You can accept in-person payments with direct integrations to your POS.

Cons

It can’t accept funds from PayPal.

The WePay ecommerce features are not as robust as PayPal’s

The ecommerce platform integrations are somewhat limited.

Who is it Best For?

WePay serves as a viable online payment processor, but its primary draw is its extra tools for crowdfunding. Not only can you accept ACH transfers for your crowdfunding campaigns, but you can list a variety of payment methods from credit cards to checks. There’s even a way to accept in-person payments.

Read our comprehensive WePay review.

Go to the top

illustration of a cat climbing a ladder

Which PayPal Alternative Should You Choose?

It makes sense that some folks used to be hesitant to move away from PayPal because compatibility issues were always arising. However, that’s not really the case anymore, and you can actually find more reliable solutions for doing business in different parts of the world.

PayPal’s rates aren’t nearly as competitive as some options out there, and PayPal has seen its fair share of lawsuits. We’re not saying you should write off PayPal altogether, but it’s not a bad idea to get a taste of the best PayPal alternatives. Who knows? You may end up saving a significant amount of money and be happier with the company you choose.

Some of the options talked about above are better for personal sending and receiving, while others are best for ecommerce payments. On the other hand, you may just be looking to collect and send ACH bank transfers. If you want a PayPal duplicate, go with Dwolla or Skrill. If you’d like to complete transactions in any country, consider 2Checkout. Google Checkout is nice for storing cards, while Authorize.net, Square, and Stripe are favorites for ecommerce transactions.

However, Wise is by far the best for international payments, whether for invoices or paying workers.

If you have any questions about the best PayPal alternatives above, feel free to drop a line in the comments below.

The post 17 Best PayPal Alternatives for 2023: Top Solutions Reviewed appeared first on Ecommerce Platforms.

Discovering Primitive Objects In JavaScript (Part 1)

Original Source: https://smashingmagazine.com/2023/02/discovering-primitive-objects-javascript-part1/

It seems natural to use strings to distinguish things. It’s very likely that in your codebase, there are objects with name, id, or label properties that are used to determine if an object is the one you’re looking for.

if (element.label === “title”) {
make_bold(element);
}

At a certain point, your project grows (in size, importance, popularity, or all at once). It needs more strings as there are more things to distinguish from each other. The strings grow longer, as does the cost of typos or, say, your label naming convention changes. Now you have to find all the instances of those strings and replace them. Consequently, a commit for that change becomes much bigger than it should be. Which makes you look better in the eyes of the clueless. Simultaneously it makes your life miserable since it’s much harder now to find the cause of regression in your git history.

Strings are bad for identification. You have to consider uniqueness and typos; your editor or IDE won’t check if it’s the string you meant. It’s bad. I hear someone saying, “Just put them in a variable, duh.” That’s a good suggestion, and it removes some of my concerns. But look at John Smith:

const john_smith_a_person = “John Smith”;
const john_smith_a_company = “John Smith”;

// Do they have the same name?
john_smith_a_person === john_smith_a_company; // true

// Are they the same thing?
john_smith_a_person === john_smith_a_company; // true

John happens to share the name with a company. What if I say to you I have a better solution? The one that removes all the concerns and adds more value — allows you to achieve more. What would you say? Well, I won’t rewrite the article just because your answer doesn’t fit my narrative. The answer is objects. You use objects themselves to figure out if an object is the one you’re looking for.

// Do they have a same name?
john_smith_a_person.name === john_smith_a_company.name; // true

// Are they the same thing?
john_smith_a_person === john_smith_a_company; // false

It makes the intent clearer. Let me give you a better example. Say you have labels in your app. They are localized, so the label string is determined by the localization library you’re using and your team’s translation process. You keep your labels in a module where you have them all neatly organized and curated. Once you need to do something special for certain labels, you can compare it directly with the one you’ve got.

import React from “react”;
import labels from “./labels.js”;

const render_label(label) => (
<Label
className={label === labels.title ? “bold” : “plain”}
icon={label.icon}
text={label.text}
/>
)

function TableOfContents({ items }) {
return (
<ul className=”my-menu”>
{items.map(render_label(item.label)}
</ul>
);
}

See how much more I can do with objects? In the labels module, I’ve set aside a label title, which in this case should be rendered bold. Plus, being an object, my label can hold a localization string (imaginatively called text) and an icon. It’s all neatly organized in advance, which keeps my UI logic clean.

But it’s just a part of the picture. I know we use objects all over the place, and it’s nothing new to group things in them. But I bet you don’t use them exactly like that. I rarely see two objects being compared like that because you never know what’s in there or where it came from. Objects are created and changed all the time. It is more likely for them to be compared by the values of their properties than the objects themselves. And the reason for that is that objects aren’t suitable for that kind of use. They are too capable. To allow that use case and many others, we have to, on the one hand, reduce some capabilities of objects and, on the other, implement some more. And in the end, we’ll get what I call Primitive Objects. Th… a solution to al… some problems.

In the first part of the series, I want to cover some aspects of JavaScript that help bring objects closer to primitive values, which in return would allow us to benefit from common language features that aren’t usually associated with an object, like comparisons and arithmetic operators. In the following part, we’ll look closely into practical examples and tools to work with such objects. Now let’s see what objects are like in JavaScript.

Properties Of Primitive Values We Need

First, let’s define our goal. Let’s draw a picture of where we would like to be afterward. What properties of primitive values do we want our objects to have?

Immutability
Primitive values are read-only. We want our objects not to be editable by anybody after their creation. Recall the example before. What use of a label do we have if some code out of our control has changed the text or icon of it? Once the object is defined, it should be set in stone.
Work with operators.
Expressions with certain operators return their appropriate type. Arithmetic operators give numbers back. Comparisons give booleans.
Have literal syntax.
Literals for primitives give you the exact value, or rather an object representing the value. Such objects get created once for each value. Each time you have “hello” in your code, you get the same object.
Have types.
The typeof operator tells you what you’re dealing with (except for null). We don’t always know which kind of object we get. So before we poke its properties, it would be nice to know what we’re dealing with.

I listed them by immediate usefulness. And as luck would have it, they are also ordered by easiest to get. In this article, I’ll cover the first one and a part of the second one. We’ll see how to make objects immutable. We also will define their representation in primitive values, which allows us to use some operators on them. Moving from objects to primitive values is easy, as primitive values are objects themselves — sort of.

It’s Objects All the Way Down, Even If It Kinda Isn’t

I remember my confusion when I first saw {} === {}; // false. What is this language that cannot even tell apart two equal things? It felt so ridiculous and amusing. It was much later that I learnt that there are much worse parts in JavaScript, after which I stopped laughing while watching wat talk.

An object is one of the fundamental things in JavaScript. You might have heard that in JavaScript, everything is an object. That’s quite true. Apart from some bottom values, all the primitives are objects. While technically, it is more nuanced, from the perspective of our code, it is true. In fact, it’s true enough that believing everything is an object might be a useful mental model. But let’s first try to understand what is happening with that object-to-object comparison that was so amusing to younger me.

Object literal syntax is used for creating new objects. It allows us to declare and initiate an object in a single expression.

// Instead of this.
const my_object = new Object();
my_object.first_property = “First property”;
my_object.nth_property = “Next property”;

// You can do this.
const my_object = {
first_property: “First property”,
nth_property: “Next property”
};

Much cleaner, right? But now I think the lack of object initialization line is what got me confused about those two empty object equality expressions. It seemed to show the language’s struggle to recognize apparent equality. But what actually happens in that expression is this:

new Object() === new Object(); // false

Now it’s obvious they aren’t equal. You’re comparing two distinct objects you’ve just created. To expect contrary is the same as expecting 5 === 3 to return true. In both cases, they are different things.

Let’s do a sanity check. Would two variables referring to the same object be considered equal?

const my_object = {};
const other_thing = my_object;
my_object === other_thing; // true

In this case, only the first line has an expression that creates an object. On the second line, we make the other_thing variable refer to a just-created object. Two variables are now referring to the same object. Comparing them is just like comparing two equal numbers, isn’t it?

Why is this significant? Because it gives us a way to check if a variable refers to an object we’re looking for. And if we think about it in the context of “everything is an object,” that’s how numbers and strings work. When you compare two variables holding strings, the engine doesn’t have to check if each character in those strings is the same. It’s enough to compare if the variables refer to the same object. That is thanks to the most significant difference between regular objects and primitive values — immutability.

How To Bring Regular Objects Closer To Primitive Values

In JavaScript, Primitive values are immutable. You cannot change a single character in a string as well as you cannot make a number five to become six. If you use const to initialize a variable and put a primitive value in it, it’ll always stay the same. No one could change the value; it’s immutable. No one could reassign the variable; it was created with const.

Let’s look closely at how numbers work. You can get six out of five by incrementing it by one, but it doesn’t change anything about five.

const five = 5;
const six = 5 + 1;
five === 5; // true

Some might say that using let would change that. But look, it cannot change five:

const five = 5;
let result = 5;
result++;
result === 6; // true
five === 5; // true

A five is still a five. That is because ++ is just a shorthand for += 1. See the equals sign? What happened was I assigned a new value to the result variable, the value that I got from the result + 1 expression (which is what += 1 is a shorthand for). The const keyword prevents reassignment to a variable. In the example above, that’s what gives me a way to know that five always refers to a 5 object.

We might assume that the only way primitive values are changed in JavaScript is through the assignment, which means what we’re actually changing is what a variable refers to. So it’s variables that are changing, not values. Not primitive ones, at least. But how it works with objects instead?

After initializing an object, you can change its properties: delete them, add new ones, and reassign old ones. We are all familiar with doing that. But apart from that, it behaves the same as primitive values. In fact, if you get accustomed to a model where objects and primitive values are the same things, you’ll look differently at all sorts of problems in JavaScript.

You probably stumbled upon a question about how variables are passed to a function. People ask whether variables are passed by value or by reference. A common answer is primitive values are passed by value while objects are passed by reference. But with the mental model I’m forcing on you here, you might already know what I will say about that. Before that, let me show you how the question doesn’t make much sense in JavaScript. I will also reveal to you a sleight of hand that many articles and tutorials use.

When you pass variables as parameters of a function call, they get assigned to the function’s arguments. Arguments are local variables to a function’s scope and have no connection back to the original variables, which makes sense. If you pass an expression to a function, you have to put the result of it somewhere, don’t you?

Look at the following two functions. They do the same thing, pass a value through, but one is defined with a single parameter, the other with none. The second one demonstrates what is happening with the parameter we passed in.

function single(arg) {
return arg;
}

function none() {

// The first parameter is assigned to a variable `arg`.
// Notice the `let`; it will be significant later.
let arg = arguments[0];

return arg;
}

single(“hi”); // “hi”
none(5); // 5

You see that they both work the same. Keeping in mind how function arguments work, let’s try changing some values. We’ll have a function that changes its only argument and returns it. I also will create some variables that I’ll pass to the function one by one. Try to predict what would be printed in the console. (Answer is in the second sentence of the next paragraph.)

function reassign(arg) {
arg = “OMG”;
}

const unreassignable = “What”;
let reassignable = “is”;
let non_primitive = { val: “happening” };

reassign(unreassignable);
reassign(reassignable);
reassign(non_primitive);

console.log(unreassignable, reassignable, non_primitive.val, “😱”);

Did your guess has any “OMG” in it? It shouldn’t have, as the console will show “What is happening 😱.” No matter what gets passed to a function in JavaScript, reassigning changes only the argument variable. So, neither const nor let change anything here because the function doesn’t get the variable itself. But what happens if we try changing the properties of an argument?

I created another function that tries to change the val property of its argument. See if you can guess the message in the console this time.

function change_val_prop(arg) {
try {
arg.val = “OMG”;
} catch (ignore) {}
}

const a_string = “What”;
const a_number = 15;
const non_primitive = { val: “happening” };
const non_primitive_read_only = Object.freeze({ my_string: “here” });

change_val_prop(a_string);
change_val_prop(a_number);
change_val_prop(non_primitive);
change_val_prop(non_primitive_read_only);

console.log(
a_string.val,
a_number.val,
non_primitive.val,
non_primitive_read_only.val,
“😱”
);

Is there any “OMG” in your guess now? Great, the message is “undefined undefined OMG undefined 😱.” The only time the function could change the property is with a common object. What does it tell us? Is there any difference between how primitive values are passed and how objects are? Is it that passing frozen object suddenly changes it to pass-by-value? I think it’s more useful to treat them as equals.

Now about that sleight of hand I mentioned. Practically all the resources do that thing where they say that primitives and objects are passed differently, then immediately follow it with an example where they treat them differently. Look at function description in MDN. By the time of this writing, it described it like this (emphasis mine):

Arguments may be passed by value (in the case of primitive values) or by reference (in the case of objects). This means that if a function reassigns a primitive type parameter, the value won’t change outside the function. In the case of an object type parameter, if its properties are mutated, the change will impact outside of the function.

I just showed you the reassigning wouldn’t change the object either. You cannot change primitives’ properties because they are read-only, which is also the case for frozen objects. And most of the examples you’ll find do the same thing. They first state the difference between two values, then demonstrate it using different methods for each value.

I’m not trying to criticize, don’t get me wrong. It probably was done because it explains JavaScript quirks in a more familiar way. Just be aware that sometimes an explanation gives you a model of thinking about a problem. But the model is never completely true to the nature of a problem.

Looking at this issue from the perspective of primitives being just like frozen objects helps you to recognize what actually happens. Alternative tutorials become illogical. And now, having discovered this notion of a primitive object that no one could change, let us make them more friendly for the rest of your program.

Converting

Primitive values stand on their own; any program knows how to handle them. Objects could be anything. And even if you call them primitive, it’s not enough for them to suddenly become first-class citizens. To achieve some of that, we need to do some work.

You can define a way to convert objects into primitive values such as strings or numbers. For example, let’s create an object representing a rating from zero to five. We need to be able to work with numeric representation for comparison and sorting. We also need to be able to output it in text.

There are certain methods that you could define to describe your object’s representation. Remember [object Object]? It’s what you get when you try to turn your object into a string:

String({}); // “[object Object]”

Let’s change that.

String Representation

That output comes from the default toString method defined in the Object prototype. But you could overwrite it by defining it on your own object.

String({ toString: () => “hello there” }); // “hello there”

That’s what we will use for our rating objects. To make it convenient, let’s create a function that initializes and freezes such objects. It will also check if the value is within the zero to five range and return undefined otherwise.

function new_rating(value) {
const max = 5;

// That symbol forces textual representation (who needs emoji anyway 🙄).
const text_only = “ufe0e”;

const star = “⭑” + text_only;
const no_star = “⭐” + text_only;

if (
!Number.isSafeInteger(value) ||
(value < 0 || value > max)
) {
return undefined;
}

return Object.freeze({
value,
toString: () => star.repeat(value) + no_star.repeat(max – value)
});
}

Now let’s rate something. There is a pen I like. It’s pretty great, and I’d give it five stars.

const ratings = new WeakMap();
ratings.set(jetstream_pen, new_rating(5));

This WeakMap for ratings is how you could assign properties to objects without actually changing them. Now, whenever we want to have a rating, we can convert both of our objects to strings.

if (ratings.has(jetstream_pen)) {
console.log(`${jetstream_pen} ${ratings.get(jetstream_pen)}`);
// “Uni-Ball Jetstream 0.5 ⭑︎⭑︎⭑︎⭑︎⭑︎”
}

Wrapping both objects in string template literal is what I relied on here to trigger the toString method. Otherwise, you could just call the String function on them, as I did at the beginning of this section.

For Numberphiles

For numbers, there’s the valueOf method, which is called whenever there’s an attempt to convert to number comparisons or math operators (except for +). Let’s add it to our new_rating function:

function new_rating(value) {
// …

return Object.freeze({
value,
toValue: () => value,
toString: () => star.repeat(value) + no_star.repeat(max – value)
});
}

Now it might seem redundant to return the value property directly. But remember that no one but us knows that it’s there. Returning it from toValue is a universal way to get a numeric representation.

Let’s say we have our pen object again. And let’s say the rating is now its property (just to simplify the example). We can now filter out items with less than four stars:

articles.filter((item) => item.rating > 3);
// [ { name: “Uni-Ball Jetstream 0.5”, … } ]

Similarly, we can sort items by rating. We can do that using the Arrays’ sort method. You probably already have your favorite little sorting function that you’d like to use, like this one:

function sorter(first, second) {
return second.rating – first.rating;
}

const sorted_by_rating = array_of.sort(sorter);

Now, sorted_by_rating holds an array of the very best items.

Conclusion

I rarely looked at objects as something that could extend what could be expressed in JavaScript. With primitive objects, that’s what I’m trying to explore. There are still things we cannot add, like new operators or literal syntax, but still, with primitive objects, we could define new types of values.

In this first part of the Primitive Objects series, I tried to give an overview of how to make objects resemble some primitives properties. You freeze them to make them read-only. You also can define a representation in primitives, either number or string, to make it work with arithmetic operators or output them in text.

In the next parts coming up next week, I aim to give more examples of usage and comparison with other approaches I’ve encountered. You will see how to make it easier to create primitive objects and turn them into structures.

In this series, I’m trying to touch on JavaScript features that can be relied on. Even if not all of it makes sense, I hope that by looking at some of the examples I gave here, you’ll learn something useful that would make working with JavaScript less brittle without unnecessarily turning to additional tools.